diff --git a/cf-framework/cf-spring-boot-starter-biz-id/src/main/java/com/cf/imes/framework/id/core/util/SnowflakeIdWorker3rd.java b/cf-framework/cf-spring-boot-starter-biz-id/src/main/java/com/cf/imes/framework/id/core/util/SnowflakeIdWorker3rd.java
index c2bbe3684..cdd3fb530 100644
--- a/cf-framework/cf-spring-boot-starter-biz-id/src/main/java/com/cf/imes/framework/id/core/util/SnowflakeIdWorker3rd.java
+++ b/cf-framework/cf-spring-boot-starter-biz-id/src/main/java/com/cf/imes/framework/id/core/util/SnowflakeIdWorker3rd.java
@@ -70,19 +70,6 @@ public class SnowflakeIdWorker3rd {
return Integer.parseInt(formatted_date);
}
- /**
- * 生成小板短编号。
- *
- *
编号以固定的 {@code 1} 开始,再拼接五位组织编号,避免其他系统截取前五位时出现前导零。
- *
- * @param organId 组织编号
- * @param id 小板序列号
- * @return 小板短编号
- */
- public static String generatePlateNo(Long organId, long id) {
- return "1" + String.format("%05d", organId) + obtainingTime() + Long.toString(id).substring(2);
- }
-
/**
* 获得下一个ID (该方法是线程安全)
*
diff --git a/cf-framework/cf-spring-boot-starter-biz-id/src/test/java/com/cf/imes/framework/id/core/util/SnowflakeIdWorker3rdTest.java b/cf-framework/cf-spring-boot-starter-biz-id/src/test/java/com/cf/imes/framework/id/core/util/SnowflakeIdWorker3rdTest.java
deleted file mode 100644
index 3f28c9e38..000000000
--- a/cf-framework/cf-spring-boot-starter-biz-id/src/test/java/com/cf/imes/framework/id/core/util/SnowflakeIdWorker3rdTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.cf.imes.framework.id.core.util;
-
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-class SnowflakeIdWorker3rdTest {
-
- @Test
- void generatePlateNoStartsWithOneAndKeepsFiveDigitOrganId() {
- String plateNo = SnowflakeIdWorker3rd.generatePlateNo(7L, 123456L);
-
- assertTrue(plateNo.startsWith("1"));
- assertEquals("00007", plateNo.substring(1, 6));
- }
-}
diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java
index 2a48e13b9..75221f00c 100644
--- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java
+++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java
@@ -569,8 +569,6 @@ public class PlateServiceImpl implements PlateService {
Map orderGoodsPlanPlateNumAndAreaRespVOMap = new HashMap<>();
- Long organId = getUserOrganId();
-
// 组装新增数据
reqVO.forEach(f -> {
@@ -586,7 +584,8 @@ public class PlateServiceImpl implements PlateService {
.build());
// 生成板编号
- String plateNo = SnowflakeIdWorker3rd.generatePlateNo(organId, idWorker.nextId());
+ long obtainingTime = idWorker.obtainingTime();
+ String plateNo = "1" + obtainingTime + Long.toString(idWorker.nextId()).substring(2);
String remake1 = f.getRemake1() == null ? "" : f.getRemake1() + ";";
@@ -603,7 +602,6 @@ public class PlateServiceImpl implements PlateService {
plateDOS.add(PlateDO.builder()
.id(plateId)
.orderId(orderId)
- .organId(organId)
.name(f.getName())
.plateNo(plateNo)
.type(OrderPlateTypeEnum.SELFINCREASINGBOARD.getType())
@@ -1228,8 +1226,8 @@ public class PlateServiceImpl implements PlateService {
@Override
public OrderPlateWechatMiniProgramCadInfoRespVO getPlateInfoByPlateNo(String plateNo) {
// 1、解析组织id,查询板件信息
- Long organId = parseOrganId(plateNo);
- organApi.validOrgan(organId).checkError();
+ Integer organId = Integer.parseInt(plateNo.substring(0, 5));
+ organApi.validOrgan(organId.longValue()).checkError();
PlateDO plateDO = plateMapper.selectOne(new LambdaQueryWrapper()
.eq(PlateDO::getOrganId, organId)
@@ -1294,8 +1292,9 @@ public class PlateServiceImpl implements PlateService {
public OrderWechatMiniProgramCadInfoRespVO getOrderInfoByPlateNo(String plateNo) {
OrderWechatMiniProgramCadInfoRespVO result = new OrderWechatMiniProgramCadInfoRespVO();
// 1、解析组织id,查询板件信息
- Long organIdLong = parseOrganId(plateNo);
- organApi.validOrgan(organIdLong).checkError();
+ Integer organId = Integer.parseInt(plateNo.substring(0, 5));
+ Long organIdLong = organId.longValue();
+ organApi.validOrgan(organId.longValue()).checkError();
PlateDO plateDO = plateMapper.selectOne(new LambdaQueryWrapper()
.eq(PlateDO::getOrganId, organIdLong)
@@ -1324,8 +1323,9 @@ public class PlateServiceImpl implements PlateService {
@Override
public OrdersViewCadViewInfoRespVO getOrderDetailsByPlateNo(String plateNo, OrderWechatMiniProgramDetailReqVO reqVO) {
// 1、解析组织id,查询板件信息
- Long organIdLong = parseOrganId(plateNo);
- organApi.validOrgan(organIdLong).checkError();
+ Integer organId = Integer.parseInt(plateNo.substring(0, 5));
+ Long organIdLong = organId.longValue();
+ organApi.validOrgan(organId.longValue()).checkError();
OrganContextHolder.setIgnore(false);
OrganContextHolder.setOrganId(organIdLong);
@@ -1357,20 +1357,4 @@ public class PlateServiceImpl implements PlateService {
return orderComponentService.getOrderViewCadInfo(detailReqVO);
}
- /**
- * 从板件短编号解析组织编号,同时兼容旧版未增加固定前缀的编号。
- *
- * @param plateNo 板件短编号
- * @return 组织编号
- */
- private Long parseOrganId(String plateNo) {
- if (plateNo.length() >= 10 && plateNo.charAt(0) == '1') {
- int year = Integer.parseInt(plateNo.substring(6, 8));
- int month = Integer.parseInt(plateNo.substring(8, 10));
- if (year >= 20 && month >= 1 && month <= 12) {
- return Long.parseLong(plateNo.substring(1, 6));
- }
- }
- return Long.parseLong(plateNo.substring(0, 5));
- }
}
diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java
index b502ffef0..962630b79 100644
--- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java
+++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java
@@ -966,6 +966,7 @@ public class ApiTypeRealize {
for (int i = 0; i < plateLists.size(); i++) {
long plateNo = idWorker.nextId();
+ long obtainingTime = idWorker.obtainingTime();
JSONObject plate = plateLists.getJSONObject(i);
@@ -983,7 +984,7 @@ public class ApiTypeRealize {
.id(plateId)
.orderId(orderId)
.name(plate.getString(ProduceApiConstants.BD_BOARD_NAME))
- .plateNo(SnowflakeIdWorker3rd.generatePlateNo(organId, plateNo))
+ .plateNo("1" + obtainingTime + Long.toString(plateNo).substring(2))
.type(type)
.goodsId(plate.getLong(ProduceApiConstants.BD_GOODS_ID))
.splitHeight(BigDecimal.valueOf(plate.getDouble(ProduceApiConstants.BD_SPLIT_HEIGHT)))
diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/excel/ExcelTypeRealize.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/excel/ExcelTypeRealize.java
index c18f5789b..53994c46c 100644
--- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/excel/ExcelTypeRealize.java
+++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/excel/ExcelTypeRealize.java
@@ -274,6 +274,7 @@ public class ExcelTypeRealize {
for (int i = 0; i < Integer.parseInt(combination.getGoodsNumber()); i++) {
long plateNo = idWorker.nextId();
+ long obtainingTime = idWorker.obtainingTime();
// 计算面积
BigDecimal area = BigDecimal.valueOf(Double.parseDouble(combination.getWidth()))
@@ -292,7 +293,7 @@ public class ExcelTypeRealize {
.plateNo(combination.getPlateNo())
.goodsId(combination.getGoodId())
.width(BigDecimal.valueOf(Double.parseDouble(combination.getWidth())))
- .plateNo(SnowflakeIdWorker3rd.generatePlateNo(organId, plateNo))
+ .plateNo("1" + obtainingTime + Long.toString(plateNo).substring(2))
.height(BigDecimal.valueOf(Double.parseDouble(combination.getHeight())))
.thickness(BigDecimal.valueOf(Double.parseDouble(combination.getThickness())))
.splitWidth(BigDecimal.valueOf(Double.parseDouble(combination.getSplitWidth())))
diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/XmlTypeRealize.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/XmlTypeRealize.java
index 5dec43740..33fb5e7ec 100644
--- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/XmlTypeRealize.java
+++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/XmlTypeRealize.java
@@ -809,6 +809,7 @@ public class XmlTypeRealize {
for (BlockXmlVO blockXmlVO : blockXmlVOS.getBlockXmlVOList()) {
long plateNo = idWorker.nextId();
+ long obtainingTime = idWorker.obtainingTime();
Long plateId = (Long) identifierGenerator.nextId(null);
// 成品面积
@@ -864,7 +865,7 @@ public class XmlTypeRealize {
.organId(organId)
.orderId(orderId)
.name(blockXmlVO.getName())
- .plateNo(SnowflakeIdWorker3rd.generatePlateNo(organId, plateNo))
+ .plateNo("1" + obtainingTime + Long.toString(plateNo).substring(2))
.type(plateType)
.goodsId(goodsId)
.width(BigDecimal.valueOf(Double.parseDouble(blockXmlVO.getWidth())))
diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultExcelOrderImportFactory.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultExcelOrderImportFactory.java
index 68beed941..5c7751dce 100644
--- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultExcelOrderImportFactory.java
+++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultExcelOrderImportFactory.java
@@ -655,6 +655,7 @@ public class DefaultExcelOrderImportFactory {
// 根据数量生成num个小板数据
for (int i = 0; i < num; i++) {
long plateNo = idWorker.nextId();
+ long obtainingTime = idWorker.obtainingTime();
long goodsId = Long.parseLong(tempDataDO.getInnerGoodsId());
// 成品宽
String width = combination.getWidth();
@@ -673,7 +674,7 @@ public class DefaultExcelOrderImportFactory {
.name(combination.getName())
.type(OrderPlateTypeEnum.LAYERBOARD.getType())
.goodsId(goodsId)
- .plateNo(SnowflakeIdWorker3rd.generatePlateNo(organId, plateNo))
+ .plateNo("1" + String.format("%05d", organId) + obtainingTime + Long.toString(plateNo).substring(2))
.height(BigDecimal.valueOf(Double.parseDouble(height)))
.width(BigDecimal.valueOf(Double.parseDouble(width)))
.thickness(BigDecimal.valueOf(Double.parseDouble(combination.getThickness())))
diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultXmlOrderImportFactory.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultXmlOrderImportFactory.java
index d504f7bc9..d541d264c 100644
--- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultXmlOrderImportFactory.java
+++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultXmlOrderImportFactory.java
@@ -465,6 +465,7 @@ public class DefaultXmlOrderImportFactory {
BlockXmlVO blockXmlVO = JSON.parseObject(detail, BlockXmlVO.class);
long plateNo = idWorker.nextId();
+ long obtainingTime = idWorker.obtainingTime();
Long plateId = (Long) snowFlakeGenerator.nextId(null);
// 成品面积
@@ -514,7 +515,7 @@ public class DefaultXmlOrderImportFactory {
.id(plateId)
.orderId(orderId)
.name(blockXmlVO.getName())
- .plateNo(SnowflakeIdWorker3rd.generatePlateNo(organId, plateNo))
+ .plateNo("1" + String.format("%05d", organId) + obtainingTime + Long.toString(plateNo).substring(2))
.type(plateType)
.goodsId(goodsId)
.width(BigDecimal.valueOf(Double.parseDouble(blockXmlVO.getWidth())))
diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/ProducingOrderImportFactory.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/ProducingOrderImportFactory.java
index f9a3c6f71..95d7545ad 100644
--- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/ProducingOrderImportFactory.java
+++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/ProducingOrderImportFactory.java
@@ -1244,6 +1244,7 @@ public class ProducingOrderImportFactory {
Long plateId = (Long) snowFlakeGenerator.nextId(null);
long plateNo = idWorker.nextId();
+ long obtainingTime = idWorker.obtainingTime();
// 从info.remarks中获取备注相关
ProducingImportBlockRemark plateRemark = getPlateRemark(block);
@@ -1268,7 +1269,7 @@ public class ProducingOrderImportFactory {
.id(plateId)
.orderId(orderId)
.name(block.getName())
- .plateNo(SnowflakeIdWorker3rd.generatePlateNo(organId, plateNo))
+ .plateNo("1" + String.format("%05d", organId) + obtainingTime + Long.toString(plateNo).substring(2))
.type(block.getType())
.goodsId(goodsDO.getId())
.width(getBigDecimalOrNull(block.getWidth()))
diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportAsyncFactory.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportAsyncFactory.java
index e494cc156..b25b7926e 100644
--- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportAsyncFactory.java
+++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportAsyncFactory.java
@@ -770,6 +770,7 @@ public class WebCadOrderImportAsyncFactory {
Long plateId = (Long) snowFlakeGenerator.nextId(null);
long plateNo = idWorker.nextId();
+ long obtainingTime = idWorker.obtainingTime();
// 从info.remarks中获取备注相关
WebCadDataBlockRemarkVO plateRemark = getPlateRemark(block);
@@ -796,7 +797,7 @@ public class WebCadOrderImportAsyncFactory {
.id(plateId)
.orderId(orderId)
.name(block.getName())
- .plateNo(SnowflakeIdWorker3rd.generatePlateNo(organId, plateNo))
+ .plateNo("1" + String.format("%05d", organId) + obtainingTime + Long.toString(plateNo).substring(2))
.type(block.getType())
.goodsId(goodsDO.getId())
.width(getBigDecimalOrNull(block.getWidth()))
diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportFactory.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportFactory.java
index a246cfaef..e9b1cf9c8 100644
--- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportFactory.java
+++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportFactory.java
@@ -953,6 +953,7 @@ public class WebCadOrderImportFactory {
Long plateId = (Long) snowFlakeGenerator.nextId(null);
long plateNo = idWorker.nextId();
+ long obtainingTime = idWorker.obtainingTime();
// 从info.remarks中获取备注相关
WebCadDataBlockRemarkVO plateRemark = getPlateRemark(block);
@@ -977,7 +978,7 @@ public class WebCadOrderImportFactory {
.id(plateId)
.orderId(orderId)
.name(block.getName())
- .plateNo(SnowflakeIdWorker3rd.generatePlateNo(organId, plateNo))
+ .plateNo("1" + String.format("%05d", organId) + obtainingTime + Long.toString(plateNo).substring(2))
.type(block.getType())
.goodsId(goodsDO.getId())
.width(getBigDecimalOrNull(block.getWidth()))