Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-bpm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
鲁鑫
topsun-bpm
Commits
834b90fb
Commit
834b90fb
authored
Dec 12, 2023
by
覃振观
👶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
23-12-12: 所有主键改为数字类型。产品编码使用单独字段显示。
parent
2deeb9f9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
302 additions
and
116 deletions
+302
-116
productDetail.js
...un-xt/src/main/webapp/biz/topsun/product/productDetail.js
+8
-6
AppConfig.java
topsun/src/main/java/com/huigou/topsun/config/AppConfig.java
+24
-0
JPAUtils.java
topsun/src/main/java/com/huigou/topsun/config/JPAUtils.java
+1
-1
ProductApplication.java
...huigou/topsun/product/application/ProductApplication.java
+3
-3
ProductApplicationImpl.java
...psun/product/application/impl/ProductApplicationImpl.java
+40
-32
ProductController.java
...m/huigou/topsun/product/controller/ProductController.java
+15
-15
Brand.java
...src/main/java/com/huigou/topsun/product/domain/Brand.java
+1
-1
Color.java
...src/main/java/com/huigou/topsun/product/domain/Color.java
+1
-1
Factory.java
...c/main/java/com/huigou/topsun/product/domain/Factory.java
+1
-1
Product.java
...c/main/java/com/huigou/topsun/product/domain/Product.java
+4
-4
ProductCategory.java
...ava/com/huigou/topsun/product/domain/ProductCategory.java
+1
-1
ProductDetail.java
.../java/com/huigou/topsun/product/domain/ProductDetail.java
+6
-6
ProductFace.java
...in/java/com/huigou/topsun/product/domain/ProductFace.java
+1
-1
ProductFaceColor.java
...va/com/huigou/topsun/product/domain/ProductFaceColor.java
+3
-3
ProductLooked.java
.../java/com/huigou/topsun/product/domain/ProductLooked.java
+6
-6
ProductLoss.java
...in/java/com/huigou/topsun/product/domain/ProductLoss.java
+2
-2
ProductMaterial.java
...ava/com/huigou/topsun/product/domain/ProductMaterial.java
+2
-2
ProductProcess.java
...java/com/huigou/topsun/product/domain/ProductProcess.java
+6
-6
ProductPublishedConf.java
...om/huigou/topsun/product/domain/ProductPublishedConf.java
+2
-2
ProductRiskDescription.java
.../huigou/topsun/product/domain/ProductRiskDescription.java
+6
-6
ProductTechnology.java
...a/com/huigou/topsun/product/domain/ProductTechnology.java
+8
-8
ProductTypesetConf.java
.../com/huigou/topsun/product/domain/ProductTypesetConf.java
+2
-2
ProductDetailRepository.java
...ou/topsun/product/repository/ProductDetailRepository.java
+1
-1
ProductLookedRepository.java
...ou/topsun/product/repository/ProductLookedRepository.java
+2
-2
ProductLossRepository.java
...igou/topsun/product/repository/ProductLossRepository.java
+1
-1
ProductMaterialRepository.java
.../topsun/product/repository/ProductMaterialRepository.java
+1
-1
ProductPublishedConfRepository.java
...un/product/repository/ProductPublishedConfRepository.java
+1
-1
ProductTypesetConfRepository.java
...psun/product/repository/ProductTypesetConfRepository.java
+1
-1
Snowflake.java
topsun/src/main/java/com/huigou/topsun/util/Snowflake.java
+71
-0
TestSnowflake.java
...n/src/main/java/com/huigou/topsun/util/TestSnowflake.java
+81
-0
No files found.
topsun-xt/src/main/webapp/biz/topsun/product/productDetail.js
View file @
834b90fb
...
@@ -54,12 +54,14 @@ function faceGrid(elId, data) {
...
@@ -54,12 +54,14 @@ function faceGrid(elId, data) {
}
}
function
save
()
{
function
save
()
{
$
(
'#submitForm'
).
ajaxSubmit
({
checkUpdata
();
url
:
web_app
.
name
+
'/product/saveProductAndDetail.ajax'
,
let
upData
=
window
.
dataSet
.
upData
;
param
:{
rawData
:
JSON
.
stringify
(
rawData
)
},
if
(
!
upData
)
{
return
;
}
success
:
function
(
data
)
{
Public
.
ajax
(
web_app
.
name
+
"/product/saveProductAndDetail.ajax"
,
{
data
:
JSON
.
stringify
(
upData
)
},
function
(
data
)
{
debugger
;
debugger
;
}
});
});
}
}
...
...
topsun/src/main/java/com/huigou/topsun/config/AppConfig.java
0 → 100644
View file @
834b90fb
package
com
.
huigou
.
topsun
.
config
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.topsun.util.Snowflake
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* AppConfig Bean配置
*
* @author qinzhenguan
* @createDate 2023/12/12 08:38
**/
@Configuration
public
class
AppConfig
{
@Bean
public
ObjectMapper
objectMapper
()
{
return
new
ObjectMapper
();
}
@Bean
public
Snowflake
snowflake
()
{
return
new
Snowflake
(
1
);
}
}
\ No newline at end of file
topsun/src/main/java/com/huigou/topsun/config/JPAUtils.java
View file @
834b90fb
...
@@ -8,7 +8,7 @@ import javax.persistence.Persistence;
...
@@ -8,7 +8,7 @@ import javax.persistence.Persistence;
* JPAUtils 用于管理 JPA EntityManager 创建工厂
* JPAUtils 用于管理 JPA EntityManager 创建工厂
*
*
* @author qinzhenguan
* @author qinzhenguan
* @create 2023/11/28 08:58
* @create
Date
2023/11/28 08:58
**/
**/
public
class
JPAUtils
{
public
class
JPAUtils
{
...
...
topsun/src/main/java/com/huigou/topsun/product/application/ProductApplication.java
View file @
834b90fb
...
@@ -34,11 +34,11 @@ public interface ProductApplication {
...
@@ -34,11 +34,11 @@ public interface ProductApplication {
/**
/**
* description 对比所有对象,并保存更改的数据。
* description 对比所有对象,并保存更改的数据。
*
* @param rawMap 原数据
* @param rawMap 原数据
* @param updateMap 提交的数据
* @return java.util.HashMap<java.lang.String, java.lang.Object>
* @return java.util.HashMap<java.lang.String, java.lang.Object>
* @author qinzhenguan
* @author qinzhenguan
* @createDate 2023/12/8 17:19
* @createDate 2023/12/8 17:19
*/
*/
HashMap
<
String
,
Object
>
save
ProductAndDetail
(
HashMap
<
String
,
Object
>
rawMap
,
HashMap
<
String
,
Object
>
updateMap
);
HashMap
<
String
,
Object
>
save
OrUpdataOnAllDetail
(
HashMap
<
String
,
Object
>
newData
);
}
}
topsun/src/main/java/com/huigou/topsun/product/application/impl/ProductApplicationImpl.java
View file @
834b90fb
This diff is collapsed.
Click to expand it.
topsun/src/main/java/com/huigou/topsun/product/controller/ProductController.java
View file @
834b90fb
package
com
.
huigou
.
topsun
.
product
.
controller
;
package
com
.
huigou
.
topsun
.
product
.
controller
;
import
com.fasterxml.jackson.core.JsonParser
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
...
@@ -31,6 +30,9 @@ public class ProductController extends CommonController {
...
@@ -31,6 +30,9 @@ public class ProductController extends CommonController {
@Autowired
@Autowired
private
ProductApplication
productService
;
private
ProductApplication
productService
;
@Autowired
private
ObjectMapper
objectMapper
;
@Override
@Override
protected
String
getPagePath
()
{
protected
String
getPagePath
()
{
return
"/biz/topsun/product/"
;
return
"/biz/topsun/product/"
;
...
@@ -56,16 +58,15 @@ public class ProductController extends CommonController {
...
@@ -56,16 +58,15 @@ public class ProductController extends CommonController {
map4
.
put
(
"六六六"
,
"666"
);
map4
.
put
(
"六六六"
,
"666"
);
map4
.
put
(
"七七七"
,
"777"
);
map4
.
put
(
"七七七"
,
"777"
);
map4
.
put
(
"八八八"
,
"888"
);
map4
.
put
(
"八八八"
,
"888"
);
this
.
putAttribute
(
"selectedCategory"
,
map4
);
return
forward
(
"product"
);
return
forward
(
"product"
);
}
}
public
String
forwardProductDetail
()
{
public
String
forwardProductDetail
()
{
ObjectMapper
m
apper
=
new
ObjectMapper
();
ObjectMapper
objectM
apper
=
new
ObjectMapper
();
SDO
sdo
=
this
.
getSDO
();
SDO
sdo
=
this
.
getSDO
();
HashMap
<
String
,
Object
>
param
;
HashMap
<
String
,
Object
>
param
;
try
{
try
{
param
=
m
apper
.
readValue
(
sdo
.
getString
(
"data"
),
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{});
param
=
objectM
apper
.
readValue
(
sdo
.
getString
(
"data"
),
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{});
}
catch
(
JsonProcessingException
e
)
{
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
...
@@ -73,12 +74,11 @@ public class ProductController extends CommonController {
...
@@ -73,12 +74,11 @@ public class ProductController extends CommonController {
}
}
public
String
loadProductDetail
()
{
public
String
loadProductDetail
()
{
ObjectMapper
mapper
=
new
ObjectMapper
();
SDO
sdo
=
this
.
getSDO
();
SDO
sdo
=
this
.
getSDO
();
Product
product
;
Product
product
;
try
{
try
{
m
apper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
objectM
apper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
product
=
m
apper
.
readValue
(
sdo
.
getString
(
"data"
)
+
""
,
Product
.
class
);
product
=
objectM
apper
.
readValue
(
sdo
.
getString
(
"data"
)
+
""
,
Product
.
class
);
}
catch
(
JsonProcessingException
e
)
{
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
...
@@ -87,15 +87,15 @@ public class ProductController extends CommonController {
...
@@ -87,15 +87,15 @@ public class ProductController extends CommonController {
return
toResult
(
resultMap
);
return
toResult
(
resultMap
);
}
}
public
String
saveProductAndDetail
()
throws
JsonProcessingException
{
public
String
saveOrUpdataOnAllDetail
()
throws
JsonProcessingException
{
ObjectMapper
mapper
=
new
ObjectMapper
();
SDO
sdo
=
this
.
getSDO
();
SDO
sdo
=
this
.
getSDO
();
String
updateJson
=
sdo
.
toString
();
HashMap
<
String
,
Object
>
newData
;
HashMap
<
String
,
Object
>
updateMap
=
mapper
.
readValue
(
updateJson
,
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{});
try
{
HashMap
<
String
,
Object
>
rawMap
=
mapper
.
readValue
(
updateMap
.
get
(
"rawData"
)
+
""
,
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{});
newData
=
objectMapper
.
readValue
(
sdo
.
getString
(
"data"
),
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{});
updateMap
.
remove
(
"rawData"
);
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
HashMap
<
String
,
Object
>
resultMap
=
productService
.
saveProductAndDetail
(
rawMap
,
updateMap
);
}
HashMap
<
String
,
Object
>
resultMap
=
productService
.
saveOrUpdataOnAllDetail
(
newData
);
return
success
(
resultMap
);
return
success
(
resultMap
);
}
}
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/Brand.java
View file @
834b90fb
...
@@ -18,7 +18,7 @@ public class Brand implements Serializable {
...
@@ -18,7 +18,7 @@ public class Brand implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"brand_id"
)
@Column
(
name
=
"brand_id"
)
private
Stri
ng
brandId
;
private
Lo
ng
brandId
;
/**
/**
* 品牌名称
* 品牌名称
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/Color.java
View file @
834b90fb
...
@@ -18,7 +18,7 @@ public class Color implements Serializable {
...
@@ -18,7 +18,7 @@ public class Color implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"color_id"
)
@Column
(
name
=
"color_id"
)
private
Stri
ng
colorId
;
private
Lo
ng
colorId
;
/**
/**
* 颜色名称
* 颜色名称
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/Factory.java
View file @
834b90fb
...
@@ -18,7 +18,7 @@ public class Factory implements Serializable {
...
@@ -18,7 +18,7 @@ public class Factory implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"factory_id"
)
@Column
(
name
=
"factory_id"
)
private
Stri
ng
factoryId
;
private
Lo
ng
factoryId
;
/**
/**
* 工厂名称
* 工厂名称
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/Product.java
View file @
834b90fb
...
@@ -21,8 +21,8 @@ public class Product implements Serializable {
...
@@ -21,8 +21,8 @@ public class Product implements Serializable {
* 产品ID
* 产品ID
*/
*/
@Id
@Id
@Column
(
name
=
"product_id"
,
nullable
=
false
,
length
=
32
)
@Column
(
name
=
"product_id"
,
nullable
=
false
)
private
Stri
ng
productId
;
private
Lo
ng
productId
;
/**
/**
* 产品名称
* 产品名称
...
@@ -170,11 +170,11 @@ public class Product implements Serializable {
...
@@ -170,11 +170,11 @@ public class Product implements Serializable {
.
toString
();
.
toString
();
}
}
public
Stri
ng
getProductId
()
{
public
Lo
ng
getProductId
()
{
return
this
.
productId
;
return
this
.
productId
;
}
}
public
void
setProductId
(
Stri
ng
productId
)
{
public
void
setProductId
(
Lo
ng
productId
)
{
this
.
productId
=
productId
;
this
.
productId
=
productId
;
}
}
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductCategory.java
View file @
834b90fb
...
@@ -18,7 +18,7 @@ public class ProductCategory implements Serializable {
...
@@ -18,7 +18,7 @@ public class ProductCategory implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_category_id"
)
@Column
(
name
=
"product_category_id"
)
private
Stri
ng
productCategoryId
;
private
Lo
ng
productCategoryId
;
/**
/**
* 产品类别名称
* 产品类别名称
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductDetail.java
View file @
834b90fb
...
@@ -22,13 +22,13 @@ public class ProductDetail implements Serializable {
...
@@ -22,13 +22,13 @@ public class ProductDetail implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_detail_id"
,
nullable
=
false
,
length
=
32
)
@Column
(
name
=
"product_detail_id"
,
nullable
=
false
,
length
=
32
)
private
Stri
ng
productDetailId
;
private
Lo
ng
productDetailId
;
/**
/**
* 产品ID
* 产品ID
*/
*/
@Column
(
name
=
"product_id"
,
nullable
=
true
,
length
=
32
)
@Column
(
name
=
"product_id"
,
nullable
=
true
,
length
=
32
)
private
Stri
ng
productId
;
private
Lo
ng
productId
;
/**
/**
* 工厂名称
* 工厂名称
...
@@ -139,19 +139,19 @@ public class ProductDetail implements Serializable {
...
@@ -139,19 +139,19 @@ public class ProductDetail implements Serializable {
.
toString
();
.
toString
();
}
}
public
Stri
ng
getProductDetailId
()
{
public
Lo
ng
getProductDetailId
()
{
return
this
.
productDetailId
;
return
this
.
productDetailId
;
}
}
public
void
setProductDetailId
(
Stri
ng
productDetailId
)
{
public
void
setProductDetailId
(
Lo
ng
productDetailId
)
{
this
.
productDetailId
=
productDetailId
;
this
.
productDetailId
=
productDetailId
;
}
}
public
Stri
ng
getProductId
()
{
public
Lo
ng
getProductId
()
{
return
this
.
productId
;
return
this
.
productId
;
}
}
public
void
setProductId
(
Stri
ng
productId
)
{
public
void
setProductId
(
Lo
ng
productId
)
{
this
.
productId
=
productId
;
this
.
productId
=
productId
;
}
}
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductFace.java
View file @
834b90fb
...
@@ -18,7 +18,7 @@ public class ProductFace implements Serializable {
...
@@ -18,7 +18,7 @@ public class ProductFace implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_face_id"
)
@Column
(
name
=
"product_face_id"
)
private
Stri
ng
productFaceId
;
private
Lo
ng
productFaceId
;
/**
/**
* 产品版面图片
* 产品版面图片
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductFaceColor.java
View file @
834b90fb
...
@@ -18,19 +18,19 @@ public class ProductFaceColor implements Serializable {
...
@@ -18,19 +18,19 @@ public class ProductFaceColor implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_face_color_id"
)
@Column
(
name
=
"product_face_color_id"
)
private
Stri
ng
productFaceColorId
;
private
Lo
ng
productFaceColorId
;
/**
/**
* 产品版面ID
* 产品版面ID
*/
*/
@Column
(
name
=
"product_face_id"
)
@Column
(
name
=
"product_face_id"
)
private
Stri
ng
productFaceId
;
private
Lo
ng
productFaceId
;
/**
/**
* 颜色ID
* 颜色ID
*/
*/
@Column
(
name
=
"color_id"
)
@Column
(
name
=
"color_id"
)
private
Stri
ng
colorId
;
private
Lo
ng
colorId
;
/**
/**
* 覆盖率(单位%)
* 覆盖率(单位%)
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductLooked.java
View file @
834b90fb
...
@@ -22,13 +22,13 @@ public class ProductLooked implements Serializable {
...
@@ -22,13 +22,13 @@ public class ProductLooked implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_looked_id"
,
nullable
=
false
,
length
=
32
)
@Column
(
name
=
"product_looked_id"
,
nullable
=
false
,
length
=
32
)
private
Stri
ng
productLookedId
;
private
Lo
ng
productLookedId
;
/**
/**
* 产品ID
* 产品ID
*/
*/
@Column
(
name
=
"product_id"
,
nullable
=
true
,
length
=
32
)
@Column
(
name
=
"product_id"
,
nullable
=
true
,
length
=
32
)
private
Stri
ng
productId
;
private
Lo
ng
productId
;
/**
/**
* 长;单位cm
* 长;单位cm
...
@@ -169,19 +169,19 @@ public class ProductLooked implements Serializable {
...
@@ -169,19 +169,19 @@ public class ProductLooked implements Serializable {
.
toString
();
.
toString
();
}
}
public
Stri
ng
getProductLookedId
()
{
public
Lo
ng
getProductLookedId
()
{
return
this
.
productLookedId
;
return
this
.
productLookedId
;
}
}
public
void
setProductLookedId
(
Stri
ng
productLookedId
)
{
public
void
setProductLookedId
(
Lo
ng
productLookedId
)
{
this
.
productLookedId
=
productLookedId
;
this
.
productLookedId
=
productLookedId
;
}
}
public
Stri
ng
getProductId
()
{
public
Lo
ng
getProductId
()
{
return
this
.
productId
;
return
this
.
productId
;
}
}
public
void
setProductId
(
Stri
ng
productId
)
{
public
void
setProductId
(
Lo
ng
productId
)
{
this
.
productId
=
productId
;
this
.
productId
=
productId
;
}
}
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductLoss.java
View file @
834b90fb
...
@@ -18,13 +18,13 @@ public class ProductLoss implements Serializable {
...
@@ -18,13 +18,13 @@ public class ProductLoss implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_loss_id"
)
@Column
(
name
=
"product_loss_id"
)
private
Stri
ng
productLossId
;
private
Lo
ng
productLossId
;
/**
/**
* 产品ID
* 产品ID
*/
*/
@Column
(
name
=
"product_id"
)
@Column
(
name
=
"product_id"
)
private
Stri
ng
productId
;
private
Lo
ng
productId
;
/**
/**
* 产品最大loss数量
* 产品最大loss数量
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductMaterial.java
View file @
834b90fb
...
@@ -18,13 +18,13 @@ public class ProductMaterial implements Serializable {
...
@@ -18,13 +18,13 @@ public class ProductMaterial implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_material_id"
)
@Column
(
name
=
"product_material_id"
)
private
Stri
ng
productMaterialId
;
private
Lo
ng
productMaterialId
;
/**
/**
* 产品ID
* 产品ID
*/
*/
@Column
(
name
=
"product_id"
)
@Column
(
name
=
"product_id"
)
private
Stri
ng
productId
;
private
Lo
ng
productId
;
/**
/**
* 物料ID
* 物料ID
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductProcess.java
View file @
834b90fb
...
@@ -22,13 +22,13 @@ public class ProductProcess implements Serializable {
...
@@ -22,13 +22,13 @@ public class ProductProcess implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_process_id"
,
nullable
=
false
,
length
=
32
)
@Column
(
name
=
"product_process_id"
,
nullable
=
false
,
length
=
32
)
private
Stri
ng
productProcessId
;
private
Lo
ng
productProcessId
;
/**
/**
* 工艺id
* 工艺id
*/
*/
@Column
(
name
=
"product_technology_id"
,
nullable
=
true
,
length
=
32
)
@Column
(
name
=
"product_technology_id"
,
nullable
=
true
,
length
=
32
)
private
Stri
ng
productTechnologyId
;
private
Lo
ng
productTechnologyId
;
/**
/**
* 生成顺序
* 生成顺序
...
@@ -92,19 +92,19 @@ public class ProductProcess implements Serializable {
...
@@ -92,19 +92,19 @@ public class ProductProcess implements Serializable {
.
toString
();
.
toString
();
}
}
public
Stri
ng
getProductProcessId
()
{
public
Lo
ng
getProductProcessId
()
{
return
this
.
productProcessId
;
return
this
.
productProcessId
;
}
}
public
void
setProductProcessId
(
Stri
ng
productProcessId
)
{
public
void
setProductProcessId
(
Lo
ng
productProcessId
)
{
this
.
productProcessId
=
productProcessId
;
this
.
productProcessId
=
productProcessId
;
}
}
public
Stri
ng
getProductTechnologyId
()
{
public
Lo
ng
getProductTechnologyId
()
{
return
this
.
productTechnologyId
;
return
this
.
productTechnologyId
;
}
}
public
void
setProductTechnologyId
(
Stri
ng
productTechnologyId
)
{
public
void
setProductTechnologyId
(
Lo
ng
productTechnologyId
)
{
this
.
productTechnologyId
=
productTechnologyId
;
this
.
productTechnologyId
=
productTechnologyId
;
}
}
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductPublishedConf.java
View file @
834b90fb
...
@@ -18,13 +18,13 @@ public class ProductPublishedConf implements Serializable {
...
@@ -18,13 +18,13 @@ public class ProductPublishedConf implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_published_conf_id"
)
@Column
(
name
=
"product_published_conf_id"
)
private
Stri
ng
productPublishedConfId
;
private
Lo
ng
productPublishedConfId
;
/**
/**
* 产品ID
* 产品ID
*/
*/
@Column
(
name
=
"product_id"
)
@Column
(
name
=
"product_id"
)
private
Stri
ng
productId
;
private
Lo
ng
productId
;
/**
/**
* 模数
* 模数
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductRiskDescription.java
View file @
834b90fb
...
@@ -22,13 +22,13 @@ public class ProductRiskDescription implements Serializable {
...
@@ -22,13 +22,13 @@ public class ProductRiskDescription implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_risk_description_id"
,
nullable
=
false
,
length
=
32
)
@Column
(
name
=
"product_risk_description_id"
,
nullable
=
false
,
length
=
32
)
private
Stri
ng
productRiskDescriptionId
;
private
Lo
ng
productRiskDescriptionId
;
/**
/**
* 产品id
* 产品id
*/
*/
@Column
(
name
=
"product_id"
,
nullable
=
true
,
length
=
32
)
@Column
(
name
=
"product_id"
,
nullable
=
true
,
length
=
32
)
private
Stri
ng
productId
;
private
Lo
ng
productId
;
/**
/**
* 序号
* 序号
...
@@ -67,19 +67,19 @@ public class ProductRiskDescription implements Serializable {
...
@@ -67,19 +67,19 @@ public class ProductRiskDescription implements Serializable {
.
toString
();
.
toString
();
}
}
public
Stri
ng
getProductRiskDescriptionId
()
{
public
Lo
ng
getProductRiskDescriptionId
()
{
return
this
.
productRiskDescriptionId
;
return
this
.
productRiskDescriptionId
;
}
}
public
void
setProductRiskDescriptionId
(
Stri
ng
productRiskDescriptionId
)
{
public
void
setProductRiskDescriptionId
(
Lo
ng
productRiskDescriptionId
)
{
this
.
productRiskDescriptionId
=
productRiskDescriptionId
;
this
.
productRiskDescriptionId
=
productRiskDescriptionId
;
}
}
public
Stri
ng
getProductId
()
{
public
Lo
ng
getProductId
()
{
return
this
.
productId
;
return
this
.
productId
;
}
}
public
void
setProductId
(
Stri
ng
productId
)
{
public
void
setProductId
(
Lo
ng
productId
)
{
this
.
productId
=
productId
;
this
.
productId
=
productId
;
}
}
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductTechnology.java
View file @
834b90fb
...
@@ -21,14 +21,14 @@ public class ProductTechnology implements Serializable {
...
@@ -21,14 +21,14 @@ public class ProductTechnology implements Serializable {
* 产品工艺id
* 产品工艺id
*/
*/
@Id
@Id
@Column
(
name
=
"product_technology_id"
,
nullable
=
false
,
length
=
32
)
@Column
(
name
=
"product_technology_id"
,
nullable
=
false
)
private
Stri
ng
productTechnologyId
;
private
Lo
ng
productTechnologyId
;
/**
/**
* 产品id
* 产品id
*/
*/
@Column
(
name
=
"product_id"
,
nullable
=
true
,
length
=
32
)
@Column
(
name
=
"product_id"
,
nullable
=
true
)
private
Stri
ng
productId
;
private
Lo
ng
productId
;
/**
/**
* 产品工艺制程
* 产品工艺制程
...
@@ -211,19 +211,19 @@ public class ProductTechnology implements Serializable {
...
@@ -211,19 +211,19 @@ public class ProductTechnology implements Serializable {
.
toString
();
.
toString
();
}
}
public
Stri
ng
getProductTechnologyId
()
{
public
Lo
ng
getProductTechnologyId
()
{
return
this
.
productTechnologyId
;
return
this
.
productTechnologyId
;
}
}
public
void
setProductTechnologyId
(
Stri
ng
productTechnologyId
)
{
public
void
setProductTechnologyId
(
Lo
ng
productTechnologyId
)
{
this
.
productTechnologyId
=
productTechnologyId
;
this
.
productTechnologyId
=
productTechnologyId
;
}
}
public
Stri
ng
getProductId
()
{
public
Lo
ng
getProductId
()
{
return
this
.
productId
;
return
this
.
productId
;
}
}
public
void
setProductId
(
Stri
ng
productId
)
{
public
void
setProductId
(
Lo
ng
productId
)
{
this
.
productId
=
productId
;
this
.
productId
=
productId
;
}
}
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/ProductTypesetConf.java
View file @
834b90fb
...
@@ -18,13 +18,13 @@ public class ProductTypesetConf implements Serializable {
...
@@ -18,13 +18,13 @@ public class ProductTypesetConf implements Serializable {
*/
*/
@Id
@Id
@Column
(
name
=
"product_typeset_conf_id"
)
@Column
(
name
=
"product_typeset_conf_id"
)
private
Stri
ng
productTypesetConfId
;
private
Lo
ng
productTypesetConfId
;
/**
/**
* 产品ID
* 产品ID
*/
*/
@Column
(
name
=
"product_id"
)
@Column
(
name
=
"product_id"
)
private
Stri
ng
productId
;
private
Lo
ng
productId
;
/**
/**
* 印张长度(单位cm)
* 印张长度(单位cm)
...
...
topsun/src/main/java/com/huigou/topsun/product/repository/ProductDetailRepository.java
View file @
834b90fb
...
@@ -9,5 +9,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
...
@@ -9,5 +9,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @Description:
* @Description:
*/
*/
public
interface
ProductDetailRepository
extends
JpaRepository
<
ProductDetail
,
String
>
{
public
interface
ProductDetailRepository
extends
JpaRepository
<
ProductDetail
,
String
>
{
ProductDetail
findByProductId
(
Stri
ng
productId
);
ProductDetail
findByProductId
(
Lo
ng
productId
);
}
}
topsun/src/main/java/com/huigou/topsun/product/repository/ProductLookedRepository.java
View file @
834b90fb
...
@@ -10,8 +10,8 @@ import org.springframework.data.jpa.repository.JpaRepository;
...
@@ -10,8 +10,8 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @Description:
* @Description:
*/
*/
public
interface
ProductLookedRepository
extends
JpaRepository
<
ProductLooked
,
String
>
{
public
interface
ProductLookedRepository
extends
JpaRepository
<
ProductLooked
,
String
>
{
ProductLooked
findByProductId
(
Stri
ng
productId
);
ProductLooked
findByProductId
(
Lo
ng
productId
);
ProductLooked
findByProductIdEquals
(
Stri
ng
productId
);
ProductLooked
findByProductIdEquals
(
Lo
ng
productId
);
}
}
topsun/src/main/java/com/huigou/topsun/product/repository/ProductLossRepository.java
View file @
834b90fb
...
@@ -11,6 +11,6 @@ import java.util.List;
...
@@ -11,6 +11,6 @@ import java.util.List;
* @Description:
* @Description:
*/
*/
public
interface
ProductLossRepository
extends
JpaRepository
<
ProductLoss
,
String
>
{
public
interface
ProductLossRepository
extends
JpaRepository
<
ProductLoss
,
String
>
{
List
<
ProductLoss
>
findByProductId
(
Stri
ng
productId
);
List
<
ProductLoss
>
findByProductId
(
Lo
ng
productId
);
}
}
topsun/src/main/java/com/huigou/topsun/product/repository/ProductMaterialRepository.java
View file @
834b90fb
...
@@ -11,5 +11,5 @@ import java.util.List;
...
@@ -11,5 +11,5 @@ import java.util.List;
* @Description:
* @Description:
*/
*/
public
interface
ProductMaterialRepository
extends
JpaRepository
<
ProductMaterial
,
String
>
{
public
interface
ProductMaterialRepository
extends
JpaRepository
<
ProductMaterial
,
String
>
{
List
<
ProductMaterial
>
findByProductId
(
Stri
ng
productId
);
List
<
ProductMaterial
>
findByProductId
(
Lo
ng
productId
);
}
}
topsun/src/main/java/com/huigou/topsun/product/repository/ProductPublishedConfRepository.java
View file @
834b90fb
...
@@ -9,7 +9,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
...
@@ -9,7 +9,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @Description:
* @Description:
*/
*/
public
interface
ProductPublishedConfRepository
extends
JpaRepository
<
ProductPublishedConf
,
String
>
{
public
interface
ProductPublishedConfRepository
extends
JpaRepository
<
ProductPublishedConf
,
String
>
{
ProductPublishedConf
findByProductId
(
Stri
ng
productId
);
ProductPublishedConf
findByProductId
(
Lo
ng
productId
);
ProductPublishedConf
getProductPublishedConfByProductId
(
String
productId
);
ProductPublishedConf
getProductPublishedConfByProductId
(
String
productId
);
}
}
topsun/src/main/java/com/huigou/topsun/product/repository/ProductTypesetConfRepository.java
View file @
834b90fb
...
@@ -9,5 +9,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
...
@@ -9,5 +9,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @Description:
* @Description:
*/
*/
public
interface
ProductTypesetConfRepository
extends
JpaRepository
<
ProductTypesetConf
,
String
>
{
public
interface
ProductTypesetConfRepository
extends
JpaRepository
<
ProductTypesetConf
,
String
>
{
ProductTypesetConf
findByProductId
(
Stri
ng
productId
);
ProductTypesetConf
findByProductId
(
Lo
ng
productId
);
}
}
topsun/src/main/java/com/huigou/topsun/util/Snowflake.java
0 → 100644
View file @
834b90fb
package
com
.
huigou
.
topsun
.
util
;
import
java.util.concurrent.ThreadLocalRandom
;
/**
* |00000000|00000000|00000000|00000000|00000000|00000000|00000000|00000000|
* |--|xxxxxxxxxxxxxx 41bit 时间戳(毫秒) xxxxxxxxxxxxxxx|--|--------|--------|
* |---------------------------------------4bit机器id|xxxx|--------|--------|
* |------------------------------------------16bit自增序列|xxxxxxxx|xxxxxxxx|
*/
public
class
Snowflake
{
// 开始时间
private
static
final
long
OFFSET
=
1686211627000L
;
private
static
long
WORKER_ID
;
/** 机器ID位 **/
private
static
final
long
WORKER_ID_BITS
=
4L
;
/** 自增序列位 **/
private
static
final
long
SEQUENCE_ID_BITS
=
16L
;
private
static
final
long
WORKER_SHIFT_BITS
=
SEQUENCE_ID_BITS
;
private
static
final
long
OFFSET_SHIFT_BITS
=
WORKER_ID_BITS
+
WORKER_SHIFT_BITS
;
private
static
long
SEQUENCE_MAX
=
(
1
<<
SEQUENCE_ID_BITS
)
-
1
;
private
static
long
lastTimestamp
=
0L
;
private
static
long
sequence
=
0L
;
public
Snowflake
(
long
workerId
)
{
WORKER_ID
=
workerId
;
}
public
static
synchronized
long
nextId
()
{
long
timestamp
=
timeGen
();
if
(
timestamp
<
lastTimestamp
)
{
System
.
out
.
println
(
"时钟回拨"
);
// 可以加入 ‘时钟序列’ 位,并缓存。
}
if
(
timestamp
==
lastTimestamp
)
{
sequence
=
++
sequence
&
SEQUENCE_MAX
;
// 到达最大序列时等待
if
(
sequence
==
0L
)
{
timestamp
=
tilNexMillis
(
lastTimestamp
);
}
//timestamp = sequence != 0 ? timestamp : tilNexMillis(lastTimestamp);
}
else
{
// 初始序列 随机 1 - 3
sequence
=
ThreadLocalRandom
.
current
().
nextLong
(
1
,
3
);
}
lastTimestamp
=
timestamp
;
// 时间戳 | 机器id | 序列号
return
(
timestamp
-
OFFSET
)
<<
OFFSET_SHIFT_BITS
|
(
WORKER_ID
<<
WORKER_SHIFT_BITS
)
|
sequence
;
}
protected
static
long
tilNexMillis
(
long
lastTimestamp
)
{
long
timestamp
=
timeGen
();
while
(
timestamp
<=
lastTimestamp
)
{
timestamp
=
timeGen
();
}
return
timestamp
;
}
protected
static
long
timeGen
()
{
return
System
.
currentTimeMillis
();
}
}
topsun/src/main/java/com/huigou/topsun/util/TestSnowflake.java
0 → 100644
View file @
834b90fb
package
com
.
huigou
.
topsun
.
util
;
import
org.junit.Test
;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
java.util.stream.Collectors
;
public
class
TestSnowflake
{
public
List
<
Long
>
list
=
new
CopyOnWriteArrayList
<>();
@Test
public
void
run
()
throws
InterruptedException
{
generateTest
();
new
Snowflake
(
1
);
final
Long
id
=
Snowflake
.
nextId
();
Date
date
=
new
Date
();
date
.
setTime
(
(
id
>>
18
)
+
1686211627000L
);
System
.
out
.
println
(
id
);
}
public
void
generateTest
()
throws
InterruptedException
{
TreadA
t1
=
new
TreadA
();
TreadB
t2
=
new
TreadB
();
t1
.
start
();
t2
.
start
();
while
(
list
.
size
()
<
60000
)
{
Thread
.
sleep
(
500
);
}
System
.
out
.
println
(
list
.
size
());
Map
<
Object
,
Long
>
map
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
l
->
l
,
Collectors
.
counting
()));
Map
<
Object
,
Long
>
sortedByCount
=
map
.
entrySet
().
stream
()
.
sorted
((
e1
,
e2
)
->
e2
.
getValue
().
compareTo
(
e1
.
getValue
()))
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
,
(
e1
,
e2
)
->
e1
,
LinkedHashMap:
:
new
));
List
<
Object
>
countList
=
map
.
entrySet
().
stream
().
filter
(
f
->
f
.
getValue
()
>
1
).
map
(
Map
.
Entry
::
getKey
).
collect
(
Collectors
.
toList
());
if
(
countList
.
size
()
>
0
)
{
System
.
out
.
println
(
"x"
);
}
}
protected
static
long
timeGen
()
{
return
System
.
currentTimeMillis
()
/
1000
;
}
public
class
TreadA
extends
Thread
{
public
void
run
()
{
super
.
run
();
//long timestamp = timeGen();
for
(
int
i
=
0
;
i
<
30000
;
i
++)
{
new
Snowflake
(
1
);
long
id
=
Snowflake
.
nextId
();
list
.
add
(
id
);
}
}
}
public
class
TreadB
extends
Thread
{
public
void
run
()
{
super
.
run
();
for
(
int
i
=
0
;
i
<
30000
;
i
++)
{
new
Snowflake
(
1
);
long
id
=
Snowflake
.
nextId
();
list
.
add
(
id
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment