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
7d737fc0
Commit
7d737fc0
authored
Jan 12, 2024
by
赵汉亭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
产品转正接口实现
parent
47194360
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
536 additions
and
101 deletions
+536
-101
product.js
topsun-xt/src/main/webapp/biz/topsun/product/product.js
+30
-11
ProductApplication.java
...huigou/topsun/product/application/ProductApplication.java
+2
-0
ProductApplicationImpl.java
...psun/product/application/impl/ProductApplicationImpl.java
+181
-89
ProductController.java
...m/huigou/topsun/product/controller/ProductController.java
+8
-0
ProductReturn.java
...va/com/huigou/topsun/product/domain/vo/ProductReturn.java
+202
-0
ProofingMakeReturn.java
...roofing/domain/proofingMake/model/ProofingMakeReturn.java
+113
-1
No files found.
topsun-xt/src/main/webapp/biz/topsun/product/product.js
View file @
7d737fc0
...
...
@@ -19,6 +19,22 @@ function loadCodeRuleListGrid() {
},
disableHandler
:
disableHandler
,
enableHandler
:
enableHandler
,
// 转变为正式产品
changeHandler
:
{
id
:
'ConversionToOfficialProducts'
,
text
:
'转为正式产品'
,
img
:
'fa-modx'
,
className
:
'btn-gray'
,
click
:
function
()
{
var
rows
=
gridManager
.
getSelectedRows
();
var
ids
=
[];
rows
.
forEach
(
row
=>
{
ids
.
push
(
row
.
productId
);
})
var
url
=
web_app
.
name
+
'/product/ConversionToOfficialProducts.ajax'
;
Public
.
ajax
(
url
,
{
ids
:
$
.
toJSON
(
ids
)},
function
()
{
reloadGrid
();
});
}
}
});
gridManager
=
UICtrl
.
grid
(
"#productListGrid"
,
{
columns
:
[
...
...
@@ -43,7 +59,7 @@ function loadCodeRuleListGrid() {
{
display
:
"ECN号"
,
name
:
"productAennr"
,
width
:
100
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"样品编号"
,
name
:
"productSampleCode"
,
width
:
150
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"品牌名称"
,
name
:
"brandName"
,
width
:
100
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
// { display: "产品类型", name: "prodcutType", width: 140, minWidth: 60, type: "datetime", align: "left"
}
{
display
:
"产品类型"
,
name
:
"productType"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
}
],
dataType
:
"server"
,
url
:
web_app
.
name
+
'/product/findProduct.ajax'
,
...
...
@@ -51,7 +67,7 @@ function loadCodeRuleListGrid() {
usePager
:
true
,
toolbar
:
toolbarOptions
,
enabledEdit
:
true
,
width
:
"
80
%"
,
width
:
"
91.9
%"
,
height
:
"100%"
,
heightDiff
:
-
8
,
checkbox
:
true
,
...
...
@@ -88,21 +104,24 @@ function addHandler() {
}
//启用
function
enableHandler
(){
DataUtil
.
updateById
({
action
:
'product/updateAProductStatus.ajax'
,
gridManager
:
gridManager
,
idFieldName
:
'productId'
,
param
:{
status
:
1
},
message
:
'common.confirm.enable'
,
onSuccess
:
function
(){
function
enableHandler
()
{
DataUtil
.
updateById
({
action
:
'product/updateAProductStatus.ajax'
,
gridManager
:
gridManager
,
idFieldName
:
'productId'
,
param
:
{
status
:
1
},
message
:
'common.confirm.enable'
,
onSuccess
:
function
()
{
reloadGrid
();
}
});
}
//禁用
function
disableHandler
(){
DataUtil
.
updateById
({
action
:
'product/updateAProductStatus.ajax'
,
gridManager
:
gridManager
,
idFieldName
:
'productId'
,
param
:{
status
:
0
},
function
disableHandler
()
{
DataUtil
.
updateById
({
action
:
'product/updateAProductStatus.ajax'
,
gridManager
:
gridManager
,
idFieldName
:
'productId'
,
param
:
{
status
:
0
},
message
:
'common.confirm.disable'
,
onSuccess
:
function
()
{
onSuccess
:
function
()
{
reloadGrid
();
}
});
...
...
topsun/src/main/java/com/huigou/topsun/product/application/ProductApplication.java
View file @
7d737fc0
...
...
@@ -63,4 +63,6 @@ public interface ProductApplication {
Map
<
String
,
Object
>
slicedProductList
(
ProductQueryRequest
queryRequest
);
void
updateAProductStatus
(
List
<
String
>
ids
,
String
status
);
void
ConversionToOfficialProducts
(
String
ids
);
}
topsun/src/main/java/com/huigou/topsun/product/application/impl/ProductApplicationImpl.java
View file @
7d737fc0
...
...
@@ -2,33 +2,41 @@ package com.huigou.topsun.product.application.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.cache.SystemCache
;
import
com.huigou.data.query.model.QueryDescriptor
;
import
com.huigou.data.query.model.QueryModel
;
import
com.huigou.topsun.product.application.*
;
import
com.huigou.topsun.product.domain.*
;
import
com.huigou.topsun.product.domain.query.ProductQueryRequest
;
import
com.huigou.topsun.product.domain.vo.ProductAllDataVo
;
import
com.huigou.topsun.product.domain.vo.ProductReturn
;
import
com.huigou.topsun.product.repository.*
;
import
com.huigou.topsun.sap.common.HttpClient
;
import
com.huigou.topsun.util.EntityConvertUtil
;
import
com.huigou.topsun.util.PersistTool
;
import
com.huigou.uasp.bmp.common.application.BaseApplication
;
import
com.huigou.util.StringUtil
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.persistence.*
;
import
java.math.BigDecimal
;
import
javax.persistence.EntityManager
;
import
javax.persistence.PersistenceContext
;
import
javax.persistence.TypedQuery
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
// @RequiredArgsConstructor 通过构造方法注入同 ProductApplication(Class a) { this.a = a; }
/**
* description 针对表【product(产品)】的数据库操作Service实现
*
* @author 16508
* @createDate 2023-11-22 10:24:31
*/
...
...
@@ -77,14 +85,19 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
private
final
ProductFaceColorApplication
productFaceColorApplication
;
private
final
ProductMaterialApplication
productMaterialApplication
;
@Autowired
private
HttpClient
httpClient
;
@Override
public
ArrayList
<
Map
<
String
,
Object
>>
findProductPage
(
int
page
,
int
size
)
{
ArrayList
<
Product
>
productPage
=
(
ArrayList
<
Product
>)
productRepository
.
findAll
();
return
objectMapper
.
convertValue
(
productPage
,
new
TypeReference
<
ArrayList
<
Map
<
String
,
Object
>>>()
{});
return
objectMapper
.
convertValue
(
productPage
,
new
TypeReference
<
ArrayList
<
Map
<
String
,
Object
>>>()
{
});
}
/**
* description 查询产品所有详细信息
*
* @param product 产品ID
* @return java.util.Map<java.lang.String, java.lang.Object>
* @author qinzhenguan
...
...
@@ -99,10 +112,10 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
ProductTechnology
productTechnology
=
technologyRepository
.
findByProductId
(
productId
);
// --------------------------------- 类别查询 ---------------------------------
ArrayList
<
Brand
>
brands
=
(
ArrayList
<
Brand
>)
brandRepository
.
findAll
();
ArrayList
<
Factory
>
factorys
=
(
ArrayList
<
Factory
>)
factoryRepository
.
findAll
();
ArrayList
<
Color
>
colors
=
(
ArrayList
<
Color
>)
colorRepository
.
findAll
();
ArrayList
<
ProductCategory
>
categorys
=
(
ArrayList
<
ProductCategory
>)
categoryRepository
.
findAll
();
ArrayList
<
Brand
>
brands
=
(
ArrayList
<
Brand
>)
brandRepository
.
findAll
();
ArrayList
<
Factory
>
factorys
=
(
ArrayList
<
Factory
>)
factoryRepository
.
findAll
();
ArrayList
<
Color
>
colors
=
(
ArrayList
<
Color
>)
colorRepository
.
findAll
();
ArrayList
<
ProductCategory
>
categorys
=
(
ArrayList
<
ProductCategory
>)
categoryRepository
.
findAll
();
// --------------------------------- 详情查询 ---------------------------------
...
...
@@ -122,9 +135,9 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
assemble
.
put
(
"productLoss"
,
loss
);
// --------------------------------- 版面查询 (关联产品id)---------------------------------
if
(
product
!=
null
)
{
if
(
product
!=
null
)
{
//ArrayList<ProductFace> frontFaces = new ArrayList<>();
if
(
product
.
getProductId
()
!=
null
)
{
if
(
product
.
getProductId
()
!=
null
)
{
//ProductFace frontFace = faceRepository.findByProductFaceId(productDetail.getRightProductFaceId());
//frontFace.setBack(false);
//ArrayList <ProductFaceColor> frontColors = (ArrayList<ProductFaceColor>) faceColorRepository.findByProductFaceId(productDetail.getRightProductFaceId());
...
...
@@ -163,8 +176,8 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
}
// --------------------------------- 工序查询 ---------------------------------
if
(
productTechnology
!=
null
)
{
if
(
productTechnology
.
getProductTechnologyId
()
!=
null
)
{
if
(
productTechnology
!=
null
)
{
if
(
productTechnology
.
getProductTechnologyId
()
!=
null
)
{
ArrayList
<
ProductProcess
>
processesed
=
(
ArrayList
<
ProductProcess
>)
processRepository
.
findByProductTechnologyId
(
productTechnology
.
getProductTechnologyId
());
assemble
.
put
(
"processed"
,
processesed
==
null
?
new
ArrayList
<>()
:
processesed
);
...
...
@@ -187,8 +200,8 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
return
resultMap
;
}
public
List
<
ProductFaceColor
>
getColor
(
List
<
ProductFaceColor
>
colorList
){
colorList
.
forEach
(
frontColor
->
{
public
List
<
ProductFaceColor
>
getColor
(
List
<
ProductFaceColor
>
colorList
)
{
colorList
.
forEach
(
frontColor
->
{
Color
color
=
colorRepository
.
findOne
(
frontColor
.
getColorId
());
frontColor
.
setColorName
(
color
.
getColorName
());
});
...
...
@@ -203,68 +216,68 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
* @createDate 2023/12/26 17:05
*/
@Override
@Transactional
(
transactionManager
=
"transactionManager"
)
@Transactional
(
transactionManager
=
"transactionManager"
)
public
HashMap
<
String
,
Object
>
saveOrUpdataOnAllDetail
(
HashMap
<
String
,
Object
>
newData
)
{
//如果productId有值,则是修改保存。否则是新增保存
String
productId
=
(
String
)
newData
.
get
(
"productId"
);
//先保存产品主表,获取到产品id,关联其他属性表
Product
product
=
objectMapper
.
convertValue
(
newData
.
get
(
"Product"
),
Product
.
class
);
if
(
ObjectUtil
.
isNotEmpty
(
product
)){
if
(
ObjectUtil
.
isNotEmpty
(
product
))
{
persist
.
persistEntity
(
product
);
//再次赋值,确保productId有值
productId
=
product
.
getProductId
();
}
//产品详情
ProductDetail
productDetail
=
objectMapper
.
convertValue
(
newData
.
get
(
"ProductDetail"
),
ProductDetail
.
class
);
if
(
ObjectUtil
.
isNotEmpty
(
productDetail
)
)
{
if
(
StringUtil
.
isBlank
(
productDetail
.
getProductId
())){
if
(
ObjectUtil
.
isNotEmpty
(
productDetail
)
)
{
if
(
StringUtil
.
isBlank
(
productDetail
.
getProductId
()))
{
productDetail
.
setProductId
(
productId
);
}
}
//产品外观
ProductLooked
productLooked
=
objectMapper
.
convertValue
(
newData
.
get
(
"ProductLooked"
),
ProductLooked
.
class
);
if
(
ObjectUtil
.
isNotEmpty
(
productLooked
)){
if
(
StringUtil
.
isBlank
(
productLooked
.
getProductId
())){
if
(
ObjectUtil
.
isNotEmpty
(
productLooked
))
{
if
(
StringUtil
.
isBlank
(
productLooked
.
getProductId
()))
{
productLooked
.
setProductId
(
productId
);
}
}
//产品正面
ProductFace
frontFace
=
objectMapper
.
convertValue
(
newData
.
get
(
"frontFace"
),
ProductFace
.
class
);
if
(
ObjectUtil
.
isNotEmpty
(
frontFace
)){
if
(
ObjectUtil
.
isNotEmpty
(
frontFace
))
{
persist
.
persistEntity
(
frontFace
);
}
//产品反面
ProductFace
backFace
=
objectMapper
.
convertValue
(
newData
.
get
(
"backFace"
),
ProductFace
.
class
);
if
(
ObjectUtil
.
isNotEmpty
(
backFace
)){
if
(
ObjectUtil
.
isNotEmpty
(
backFace
))
{
persist
.
persistEntity
(
backFace
);
//this.convertToFaceColors(uncheckedCast(newData.get("backColors")),backFace.getProductFaceId());
}
//产品工艺
ProductTechnology
productTechnology
=
objectMapper
.
convertValue
(
newData
.
get
(
"ProductTechnology"
),
ProductTechnology
.
class
);
if
(
ObjectUtil
.
isNotEmpty
(
productTechnology
)){
if
(
StringUtil
.
isBlank
(
productTechnology
.
getProductId
())){
if
(
ObjectUtil
.
isNotEmpty
(
productTechnology
))
{
if
(
StringUtil
.
isBlank
(
productTechnology
.
getProductId
()))
{
productTechnology
.
setProductId
(
productId
);
}
persist
.
persistEntity
(
productTechnology
);
convertToProcesseds
(
uncheckedCast
(
newData
.
get
(
"processed"
)),
productTechnology
.
getProductTechnologyId
());
convertToProcesseds
(
uncheckedCast
(
newData
.
get
(
"processed"
)),
productTechnology
.
getProductTechnologyId
());
}
//产品参数配置
ProductPublishedConf
productPublishedConf
=
objectMapper
.
convertValue
(
newData
.
get
(
"ProductPublishedConf"
),
ProductPublishedConf
.
class
);
if
(
ObjectUtil
.
isNotEmpty
(
productPublishedConf
)){
if
(
StringUtil
.
isBlank
(
productPublishedConf
.
getProductId
())){
if
(
ObjectUtil
.
isNotEmpty
(
productPublishedConf
))
{
if
(
StringUtil
.
isBlank
(
productPublishedConf
.
getProductId
()))
{
productPublishedConf
.
setProductId
(
productId
);
}
}
// --------------------------------- 反序列化 List (可在此加入业务逻辑) ---------------------------------
HashMap
<
String
,
Object
>
frontColors
=
convertToFaceColors
(
uncheckedCast
(
newData
.
get
(
"frontColors"
)),
"front"
,
productId
);
HashMap
<
String
,
Object
>
backColors
=
convertToFaceColors
(
uncheckedCast
(
newData
.
get
(
"backColors"
)),
"back"
,
productId
);
HashMap
<
String
,
Object
>
frontColors
=
convertToFaceColors
(
uncheckedCast
(
newData
.
get
(
"frontColors"
)),
"front"
,
productId
);
HashMap
<
String
,
Object
>
backColors
=
convertToFaceColors
(
uncheckedCast
(
newData
.
get
(
"backColors"
)),
"back"
,
productId
);
HashMap
<
String
,
Object
>
lossed
=
convertToLossed
(
uncheckedCast
(
newData
.
get
(
"productLoss"
)),
productId
);
List
<
Map
<
String
,
Object
>>
maps
=
Stream
.
of
(
lossed
,
frontColors
,
backColors
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
Object
>>
maps
=
Stream
.
of
(
lossed
,
frontColors
,
backColors
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Object
>
mergedMap
=
maps
.
stream
()
.
flatMap
(
map
->
map
.
entrySet
().
stream
())
.
filter
(
entry
->
entry
.
getValue
()
!=
null
)
...
...
@@ -294,7 +307,7 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>(
5
);
map
.
put
(
"save"
,
"ok"
);
map
.
put
(
"productId"
,
productId
);
map
.
put
(
"productId"
,
productId
);
return
map
;
}
...
...
@@ -330,22 +343,22 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
public
ProductAllDataVo
findProductAllData
(
String
productId
)
{
ProductAllDataVo
productAllDataVo
=
new
ProductAllDataVo
();
Product
product
=
productRepository
.
findOne
(
productId
);
BeanUtil
.
copyProperties
(
product
,
productAllDataVo
);
BeanUtil
.
copyProperties
(
product
,
productAllDataVo
);
ProductDetail
productDetail
=
detailRepository
.
findByProductId
(
productId
);
BeanUtil
.
copyProperties
(
productDetail
,
productAllDataVo
,
"productId"
);
BeanUtil
.
copyProperties
(
productDetail
,
productAllDataVo
,
"productId"
);
ProductTechnology
productTechnology
=
technologyRepository
.
findByProductId
(
productId
);
BeanUtil
.
copyProperties
(
productTechnology
,
productAllDataVo
,
"productId"
);
BeanUtil
.
copyProperties
(
productTechnology
,
productAllDataVo
,
"productId"
);
ProductTypesetConf
productTypesetConf
=
typesetConfRepository
.
findByProductId
(
productId
);
BeanUtil
.
copyProperties
(
productTypesetConf
,
productAllDataVo
,
"productId"
);
BeanUtil
.
copyProperties
(
productTypesetConf
,
productAllDataVo
,
"productId"
);
ProductLooked
productLooked
=
lookedRepository
.
findByProductId
(
productId
);
BeanUtil
.
copyProperties
(
productLooked
,
productAllDataVo
,
"productId"
);
BeanUtil
.
copyProperties
(
productLooked
,
productAllDataVo
,
"productId"
);
ProductPublishedConf
publishedConf
=
publishedConfRepository
.
findByProductId
(
productId
);
BeanUtil
.
copyProperties
(
publishedConf
,
productAllDataVo
,
"productId"
);
BeanUtil
.
copyProperties
(
publishedConf
,
productAllDataVo
,
"productId"
);
return
productAllDataVo
;
}
...
...
@@ -353,19 +366,19 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
@Override
public
Map
<
String
,
Object
>
saveProductAllData
(
Product
product
,
ProductDetail
productDetail
,
ProductFace
productFace
,
ProductLooked
productLooked
,
ProductPublishedConf
productPublishedConf
,
ProductTechnology
productTechnology
,
List
<
ProductLoss
>
lossList
,
List
<
ProductProcess
>
processList
,
List
<
ProductFaceColor
>
frontFaceColorList
,
List
<
ProductFaceColor
>
backFaceColorList
,
List
<
ProductMaterial
>
productMaterialList
)
{
product
=
this
.
saveProduct
(
product
);
productDetailApplication
.
saveProductDetail
(
product
.
getProductId
(),
productDetail
);
productFaceApplication
.
saveProductFace
(
product
.
getProductId
(),
productFace
);
productLookedApplication
.
saveProductLooked
(
product
.
getProductId
(),
productLooked
);
productPublishedConfApplication
.
saveProductPublishedConf
(
product
.
getProductId
(),
productPublishedConf
);
productTechnologyApplication
.
saveProductTechnology
(
product
.
getProductId
(),
productTechnology
);
productLossApplication
.
saveProductLossList
(
product
.
getProductId
(),
lossList
);
productProcessApplication
.
saveProductProcessList
(
productTechnology
.
getProductTechnologyId
(),
processList
);
productFaceColorApplication
.
saveProductFaceColorList
(
product
.
getProductId
(),
frontFaceColorList
);
productFaceColorApplication
.
saveProductFaceColorList
(
product
.
getProductId
(),
backFaceColorList
);
productMaterialApplication
.
saveProductMaterial
(
product
.
getProductId
(),
productMaterialList
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"productId"
,
product
.
getProductId
());
map
.
put
(
"productTechnologyId"
,
productTechnology
.
getProductTechnologyId
());
productDetailApplication
.
saveProductDetail
(
product
.
getProductId
(),
productDetail
);
productFaceApplication
.
saveProductFace
(
product
.
getProductId
(),
productFace
);
productLookedApplication
.
saveProductLooked
(
product
.
getProductId
(),
productLooked
);
productPublishedConfApplication
.
saveProductPublishedConf
(
product
.
getProductId
(),
productPublishedConf
);
productTechnologyApplication
.
saveProductTechnology
(
product
.
getProductId
(),
productTechnology
);
productLossApplication
.
saveProductLossList
(
product
.
getProductId
(),
lossList
);
productProcessApplication
.
saveProductProcessList
(
productTechnology
.
getProductTechnologyId
(),
processList
);
productFaceColorApplication
.
saveProductFaceColorList
(
product
.
getProductId
(),
frontFaceColorList
);
productFaceColorApplication
.
saveProductFaceColorList
(
product
.
getProductId
(),
backFaceColorList
);
productMaterialApplication
.
saveProductMaterial
(
product
.
getProductId
(),
productMaterialList
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"productId"
,
product
.
getProductId
());
map
.
put
(
"productTechnologyId"
,
productTechnology
.
getProductTechnologyId
());
return
map
;
}
...
...
@@ -378,87 +391,166 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
@Override
public
void
updateAProductStatus
(
List
<
String
>
ids
,
String
status
)
{
ids
.
forEach
(
id
->
{
ids
.
forEach
(
id
->
{
Product
product
=
productRepository
.
findOne
(
id
);
product
.
setProductStatus
(
status
);
productRepository
.
save
(
product
);
});
}
/**
* 转为正式产品
*/
@Override
public
void
ConversionToOfficialProducts
(
String
ids
)
{
List
<
String
>
list
;
try
{
list
=
objectMapper
.
readValue
(
ids
,
new
TypeReference
<
List
<
String
>>()
{
});
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
}
List
<
ProductReturn
>
productReturnList
=
new
ArrayList
<>();
for
(
String
productId
:
list
)
{
Product
product
=
productRepository
.
findOne
(
productId
);
product
.
setProductType
(
"正式产品"
);
productRepository
.
save
(
product
);
// TODO 发送到SAP
// 查询BOM信息
List
<
ProductMaterial
>
productMaterialList
=
materialRepository
.
findByProductId
(
productId
);
// 查询基本信息 - 已查
// 查询商品外观 - 获取单层厚、单重
ProductLooked
productLooked
=
lookedRepository
.
findByProductId
(
productId
);
// 查询排版参数配置 - 获取排版行数、派工倍数
ProductPublishedConf
publishedConf
=
publishedConfRepository
.
findByProductId
(
productId
);
List
<
Map
<
String
,
Object
>>
returnBOM
=
null
;
try
{
returnBOM
=
getReturnBOM
(
productMaterialList
);
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
}
ProductReturn
productReturn
=
new
ProductReturn
();
BeanUtil
.
copyProperties
(
product
,
productReturn
);
BeanUtil
.
copyProperties
(
productLooked
,
productReturn
);
BeanUtil
.
copyProperties
(
publishedConf
,
productReturn
);
productReturn
.
setBOMItems
(
returnBOM
);
// 封装数据
productReturnList
.
add
(
productReturn
);
}
// 发送给SAP
// TODO 接口未定、返回数据未解析
String
url
=
SystemCache
.
getParameter
(
"sap.service.null.url"
,
String
.
class
);
try
{
String
execute
=
httpClient
.
execute
(
productReturnList
,
url
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
private
List
<
ProductReturn
>
getReturnList
(
Product
product
,
List
<
ProductMaterial
>
productMaterialList
,
ProductLooked
productLooked
,
ProductPublishedConf
publishedConf
)
{
return
null
;
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
uncheckedCast
(
Object
obj
)
{
if
(
obj
!=
null
)
{
if
(
obj
!=
null
)
{
return
(
T
)
obj
;
}
return
null
;
}
public
HashMap
<
String
,
Object
>
convertToFaceColors
(
Map
<
String
,
ArrayList
<
Map
<
String
,
Object
>>>
map
,
String
type
,
String
productId
)
{
if
(
map
==
null
)
{
public
HashMap
<
String
,
Object
>
convertToFaceColors
(
Map
<
String
,
ArrayList
<
Map
<
String
,
Object
>>>
map
,
String
type
,
String
productId
)
{
if
(
map
==
null
)
{
return
null
;
}
HashMap
<
String
,
Object
>
retult
=
new
HashMap
<>(
5
);
retult
.
put
(
"add"
,
convertColor
(
map
.
get
(
"add"
),
type
,
productId
));
retult
.
put
(
"up"
,
convertColor
(
map
.
get
(
"up"
),
type
,
productId
));
retult
.
put
(
"del"
,
convertColor
(
map
.
get
(
"del"
),
type
,
productId
));
retult
.
put
(
"add"
,
convertColor
(
map
.
get
(
"add"
),
type
,
productId
));
retult
.
put
(
"up"
,
convertColor
(
map
.
get
(
"up"
),
type
,
productId
));
retult
.
put
(
"del"
,
convertColor
(
map
.
get
(
"del"
),
type
,
productId
));
return
retult
;
}
public
ArrayList
<
ProductFaceColor
>
convertColor
(
ArrayList
<
Map
<
String
,
Object
>>
list
,
String
type
,
String
productId
)
{
if
(
list
.
size
()
==
0
)
{
public
ArrayList
<
ProductFaceColor
>
convertColor
(
ArrayList
<
Map
<
String
,
Object
>>
list
,
String
type
,
String
productId
)
{
if
(
list
.
size
()
==
0
)
{
return
null
;
}
list
.
forEach
(
faceColor
->{
faceColor
.
put
(
"productId"
,
productId
);
faceColor
.
put
(
"face"
,
type
);
list
.
forEach
(
faceColor
->
{
faceColor
.
put
(
"productId"
,
productId
);
faceColor
.
put
(
"face"
,
type
);
});
return
objectMapper
.
convertValue
(
list
,
new
TypeReference
<
ArrayList
<
ProductFaceColor
>>()
{
});
return
objectMapper
.
convertValue
(
list
,
new
TypeReference
<
ArrayList
<
ProductFaceColor
>>()
{});
}
private
HashMap
<
String
,
Object
>
convertToProcesseds
(
Map
<
String
,
ArrayList
<
Map
<
String
,
Object
>>>
map
,
String
productTechnologyId
)
{
if
(
map
==
null
)
{
private
HashMap
<
String
,
Object
>
convertToProcesseds
(
Map
<
String
,
ArrayList
<
Map
<
String
,
Object
>>>
map
,
String
productTechnologyId
)
{
if
(
map
==
null
)
{
return
null
;
}
HashMap
<
String
,
Object
>
retult
=
new
HashMap
<>(
5
);
retult
.
put
(
"add"
,
convertProcessed
(
map
.
get
(
"add"
),
productTechnologyId
));
retult
.
put
(
"up"
,
convertProcessed
(
map
.
get
(
"up"
),
productTechnologyId
));
retult
.
put
(
"del"
,
convertProcessed
(
map
.
get
(
"del"
),
productTechnologyId
));
retult
.
put
(
"add"
,
convertProcessed
(
map
.
get
(
"add"
),
productTechnologyId
));
retult
.
put
(
"up"
,
convertProcessed
(
map
.
get
(
"up"
),
productTechnologyId
));
retult
.
put
(
"del"
,
convertProcessed
(
map
.
get
(
"del"
),
productTechnologyId
));
return
retult
;
}
public
ArrayList
<
ProductProcess
>
convertProcessed
(
ArrayList
<
Map
<
String
,
Object
>>
list
,
String
productTechnologyId
)
{
if
(
list
.
size
()
==
0
)
{
public
ArrayList
<
ProductProcess
>
convertProcessed
(
ArrayList
<
Map
<
String
,
Object
>>
list
,
String
productTechnologyId
)
{
if
(
list
.
size
()
==
0
)
{
return
null
;
}
list
.
forEach
(
process
->{
process
.
put
(
"productTechnologyId"
,
productTechnologyId
);
list
.
forEach
(
process
->
{
process
.
put
(
"productTechnologyId"
,
productTechnologyId
);
});
return
objectMapper
.
convertValue
(
list
,
new
TypeReference
<
ArrayList
<
ProductProcess
>>()
{
});
return
objectMapper
.
convertValue
(
list
,
new
TypeReference
<
ArrayList
<
ProductProcess
>>()
{});
}
private
HashMap
<
String
,
Object
>
convertToLossed
(
Map
<
String
,
ArrayList
<
Map
<
String
,
Object
>>>
map
,
String
productId
)
{
if
(
map
==
null
)
{
private
HashMap
<
String
,
Object
>
convertToLossed
(
Map
<
String
,
ArrayList
<
Map
<
String
,
Object
>>>
map
,
String
productId
)
{
if
(
map
==
null
)
{
return
null
;
}
HashMap
<
String
,
Object
>
retult
=
new
HashMap
<>(
5
);
retult
.
put
(
"add"
,
convertLossed
(
map
.
get
(
"add"
),
productId
));
retult
.
put
(
"up"
,
convertLossed
(
map
.
get
(
"up"
),
productId
));
retult
.
put
(
"del"
,
convertLossed
(
map
.
get
(
"del"
),
productId
));
retult
.
put
(
"add"
,
convertLossed
(
map
.
get
(
"add"
),
productId
));
retult
.
put
(
"up"
,
convertLossed
(
map
.
get
(
"up"
),
productId
));
retult
.
put
(
"del"
,
convertLossed
(
map
.
get
(
"del"
),
productId
));
return
retult
;
}
public
ArrayList
<
ProductLoss
>
convertLossed
(
ArrayList
<
Map
<
String
,
Object
>>
list
,
String
productId
)
{
if
(
list
.
size
()
==
0
)
{
public
ArrayList
<
ProductLoss
>
convertLossed
(
ArrayList
<
Map
<
String
,
Object
>>
list
,
String
productId
)
{
if
(
list
.
size
()
==
0
)
{
return
null
;
}
if
(
StringUtil
.
isNotBlank
(
productId
)){
list
.
forEach
(
loss
->
{
loss
.
put
(
"productId"
,
productId
);
if
(
StringUtil
.
isNotBlank
(
productId
))
{
list
.
forEach
(
loss
->
{
loss
.
put
(
"productId"
,
productId
);
});
}
return
objectMapper
.
convertValue
(
list
,
new
TypeReference
<
ArrayList
<
ProductLoss
>>()
{});
return
objectMapper
.
convertValue
(
list
,
new
TypeReference
<
ArrayList
<
ProductLoss
>>()
{
});
}
public
List
<
Map
<
String
,
Object
>>
getReturnBOM
(
List
<
ProductMaterial
>
productMaterialList
)
throws
JsonProcessingException
{
List
<
Map
<
String
,
Object
>>
returnBOMList
=
new
ArrayList
<>();
for
(
ProductMaterial
productMaterial
:
productMaterialList
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"IDNRK"
,
productMaterial
.
getProductMaterialId
());
map
.
put
(
"MENGE"
,
productMaterial
.
getMaterialNumber
());
map
.
put
(
"MEINS"
,
productMaterial
.
getMaterialUnit
());
map
.
put
(
"AUSCH"
,
productMaterial
.
getMaterialAusch
());
map
.
put
(
"POTX1"
,
productMaterial
.
getMaterialPotx1
());
map
.
put
(
"POTX2"
,
productMaterial
.
getMaterialJson
());
map
.
put
(
"ALPGR"
,
productMaterial
.
getMaterialAlpgr
());
map
.
put
(
"ALPRF"
,
productMaterial
.
getMaterialAlprf
());
map
.
put
(
"ALPST"
,
productMaterial
.
getMaterialAlpst
());
map
.
put
(
"EWAHR"
,
productMaterial
.
getMaterialEwahr
());
returnBOMList
.
add
(
map
);
}
return
returnBOMList
;
}
}
...
...
topsun/src/main/java/com/huigou/topsun/product/controller/ProductController.java
View file @
7d737fc0
...
...
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.context.Operator
;
import
com.huigou.topsun.product.application.*
;
import
com.huigou.topsun.product.domain.*
;
import
com.huigou.topsun.product.domain.query.ProductQueryRequest
;
...
...
@@ -224,6 +225,13 @@ public class ProductController extends CommonController {
productService
.
updateAProductStatus
(
ids
,
status
);
return
success
();
}
public
String
ConversionToOfficialProducts
(){
SDO
sdo
=
this
.
getSDO
();
String
ids
=
sdo
.
getString
(
"ids"
);
productService
.
ConversionToOfficialProducts
(
ids
);
return
success
();
}
}
//// 通过此方法可以查看系统配置的 字典 的数据结构
...
...
topsun/src/main/java/com/huigou/topsun/product/domain/vo/ProductReturn.java
0 → 100644
View file @
7d737fc0
package
com
.
huigou
.
topsun
.
product
.
domain
.
vo
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* title: 转正数据传SAP接口
* author:ZHT
* date:2024/1/8
* description:
*/
public
class
ProductReturn
implements
Serializable
{
/**
* 产品编码
*/
@JsonProperty
(
"MATNR"
)
private
String
productCode
;
/**
* 产品名称
*/
@JsonProperty
(
value
=
"MAKTX"
,
required
=
true
)
private
String
productName
;
/**
* 产品数量
*/
@JsonProperty
(
value
=
"BMENG"
,
required
=
true
)
private
String
productNumber
;
/**
* 产品计量单位
*/
@JsonProperty
(
value
=
"BMEIN"
,
required
=
true
)
private
String
productUnit
;
/**
* BOM有效起始日期
*/
@JsonProperty
(
value
=
"DATUV"
,
required
=
true
)
private
Date
productDatuy
;
/**
* ECN号
*/
@JsonProperty
(
value
=
"AENNR"
,
required
=
true
)
private
String
productAennr
;
/**
* 单层厚(单位丝)
*/
@JsonProperty
(
value
=
"ZDCH"
,
required
=
true
)
private
Integer
productSingleLayer
;
/**
* 单重(单位KG)
*/
@JsonProperty
(
value
=
"ZDANZ"
,
required
=
true
)
private
Double
productSingleWeight
;
/**
* 行数
*/
@JsonProperty
(
value
=
"ZPBHS"
,
required
=
true
)
private
Integer
rowNum
;
/**
* 派工倍数
*/
@JsonProperty
(
value
=
"ZPGBS"
,
required
=
true
)
private
Integer
dispatchMultiple
;
/**
* 更新标识
*/
@JsonProperty
(
required
=
true
)
private
String
UPDKZ
;
/**
* bom结点
*/
private
List
<
Map
<
String
,
Object
>>
BOMItems
;
public
String
getProductCode
()
{
return
productCode
;
}
public
void
setProductCode
(
String
productCode
)
{
this
.
productCode
=
productCode
;
}
public
String
getProductName
()
{
return
productName
;
}
public
void
setProductName
(
String
productName
)
{
this
.
productName
=
productName
;
}
public
String
getProductNumber
()
{
return
productNumber
;
}
public
void
setProductNumber
(
String
productNumber
)
{
this
.
productNumber
=
productNumber
;
}
public
String
getProductUnit
()
{
return
productUnit
;
}
public
void
setProductUnit
(
String
productUnit
)
{
this
.
productUnit
=
productUnit
;
}
public
Date
getProductDatuy
()
{
return
productDatuy
;
}
public
void
setProductDatuy
(
Date
productDatuy
)
{
this
.
productDatuy
=
productDatuy
;
}
public
String
getProductAennr
()
{
return
productAennr
;
}
public
void
setProductAennr
(
String
productAennr
)
{
this
.
productAennr
=
productAennr
;
}
public
Integer
getProductSingleLayer
()
{
return
productSingleLayer
;
}
public
void
setProductSingleLayer
(
Integer
productSingleLayer
)
{
this
.
productSingleLayer
=
productSingleLayer
;
}
public
Double
getProductSingleWeight
()
{
return
productSingleWeight
;
}
public
void
setProductSingleWeight
(
Double
productSingleWeight
)
{
this
.
productSingleWeight
=
productSingleWeight
;
}
public
Integer
getRowNum
()
{
return
rowNum
;
}
public
void
setRowNum
(
Integer
rowNum
)
{
this
.
rowNum
=
rowNum
;
}
public
Integer
getDispatchMultiple
()
{
return
dispatchMultiple
;
}
public
void
setDispatchMultiple
(
Integer
dispatchMultiple
)
{
this
.
dispatchMultiple
=
dispatchMultiple
;
}
public
String
getUPDKZ
()
{
return
UPDKZ
;
}
public
void
setUPDKZ
(
String
UPDKZ
)
{
this
.
UPDKZ
=
UPDKZ
;
}
public
List
<
Map
<
String
,
Object
>>
getBOMItems
()
{
return
BOMItems
;
}
public
void
setBOMItems
(
List
<
Map
<
String
,
Object
>>
BOMItems
)
{
this
.
BOMItems
=
BOMItems
;
}
public
ProductReturn
()
{
}
public
ProductReturn
(
String
productCode
,
String
productName
,
String
productNumber
,
String
productUnit
,
Date
productDatuy
,
String
productAennr
,
Integer
productSingleLayer
,
Double
productSingleWeight
,
Integer
rowNum
,
Integer
dispatchMultiple
,
String
UPDKZ
,
List
<
Map
<
String
,
Object
>>
BOMItems
)
{
this
.
productCode
=
productCode
;
this
.
productName
=
productName
;
this
.
productNumber
=
productNumber
;
this
.
productUnit
=
productUnit
;
this
.
productDatuy
=
productDatuy
;
this
.
productAennr
=
productAennr
;
this
.
productSingleLayer
=
productSingleLayer
;
this
.
productSingleWeight
=
productSingleWeight
;
this
.
rowNum
=
rowNum
;
this
.
dispatchMultiple
=
dispatchMultiple
;
this
.
UPDKZ
=
UPDKZ
;
this
.
BOMItems
=
BOMItems
;
}
}
topsun/src/main/java/com/huigou/topsun/proofing/domain/proofingMake/model/ProofingMakeReturn.java
View file @
7d737fc0
...
...
@@ -14,7 +14,6 @@ import java.util.Map;
* date:2024/1/8
* description:
*/
@Data
public
class
ProofingMakeReturn
implements
Serializable
{
/**
* 产品编码
...
...
@@ -87,4 +86,117 @@ public class ProofingMakeReturn implements Serializable {
*/
private
List
<
Map
<
String
,
Object
>>
BOMItems
;
public
ProofingMakeReturn
()
{
}
public
ProofingMakeReturn
(
String
productCode
,
String
productName
,
String
productNumber
,
String
productUnit
,
Date
productDatuy
,
String
productAennr
,
Integer
productSingleLayer
,
Double
productSingleWeight
,
Integer
rowNum
,
Integer
dispatchMultiple
,
String
UPDKZ
,
List
<
Map
<
String
,
Object
>>
BOMItems
)
{
this
.
productCode
=
productCode
;
this
.
productName
=
productName
;
this
.
productNumber
=
productNumber
;
this
.
productUnit
=
productUnit
;
this
.
productDatuy
=
productDatuy
;
this
.
productAennr
=
productAennr
;
this
.
productSingleLayer
=
productSingleLayer
;
this
.
productSingleWeight
=
productSingleWeight
;
this
.
rowNum
=
rowNum
;
this
.
dispatchMultiple
=
dispatchMultiple
;
this
.
UPDKZ
=
UPDKZ
;
this
.
BOMItems
=
BOMItems
;
}
public
String
getProductCode
()
{
return
productCode
;
}
public
void
setProductCode
(
String
productCode
)
{
this
.
productCode
=
productCode
;
}
public
String
getProductName
()
{
return
productName
;
}
public
void
setProductName
(
String
productName
)
{
this
.
productName
=
productName
;
}
public
String
getProductNumber
()
{
return
productNumber
;
}
public
void
setProductNumber
(
String
productNumber
)
{
this
.
productNumber
=
productNumber
;
}
public
String
getProductUnit
()
{
return
productUnit
;
}
public
void
setProductUnit
(
String
productUnit
)
{
this
.
productUnit
=
productUnit
;
}
public
Date
getProductDatuy
()
{
return
productDatuy
;
}
public
void
setProductDatuy
(
Date
productDatuy
)
{
this
.
productDatuy
=
productDatuy
;
}
public
String
getProductAennr
()
{
return
productAennr
;
}
public
void
setProductAennr
(
String
productAennr
)
{
this
.
productAennr
=
productAennr
;
}
public
Integer
getProductSingleLayer
()
{
return
productSingleLayer
;
}
public
void
setProductSingleLayer
(
Integer
productSingleLayer
)
{
this
.
productSingleLayer
=
productSingleLayer
;
}
public
Double
getProductSingleWeight
()
{
return
productSingleWeight
;
}
public
void
setProductSingleWeight
(
Double
productSingleWeight
)
{
this
.
productSingleWeight
=
productSingleWeight
;
}
public
Integer
getRowNum
()
{
return
rowNum
;
}
public
void
setRowNum
(
Integer
rowNum
)
{
this
.
rowNum
=
rowNum
;
}
public
Integer
getDispatchMultiple
()
{
return
dispatchMultiple
;
}
public
void
setDispatchMultiple
(
Integer
dispatchMultiple
)
{
this
.
dispatchMultiple
=
dispatchMultiple
;
}
public
String
getUPDKZ
()
{
return
UPDKZ
;
}
public
void
setUPDKZ
(
String
UPDKZ
)
{
this
.
UPDKZ
=
UPDKZ
;
}
public
List
<
Map
<
String
,
Object
>>
getBOMItems
()
{
return
BOMItems
;
}
public
void
setBOMItems
(
List
<
Map
<
String
,
Object
>>
BOMItems
)
{
this
.
BOMItems
=
BOMItems
;
}
}
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