Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
enterprise-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
enterprise-platform
Commits
a1553220
Commit
a1553220
authored
Oct 09, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改产品分类与公司查询
parent
8d8da1b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
14 deletions
+25
-14
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
...s/xhx/module/product/service/impl/ProductServiceImpl.java
+25
-14
No files found.
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
View file @
a1553220
package
com.mortals.xhx.module.product.service.impl
;
package
com.mortals.xhx.module.product.service.impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
...
@@ -219,12 +220,19 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
...
@@ -219,12 +220,19 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
}
}
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
List
<
CompanyProductEntity
>
companyProductList
=
Arrays
.
asList
(
entity
.
getCompanyId
().
split
(
","
)).
stream
().
map
(
item
->
{
Long
[]
companyProductRemoveIds
=
companyProductService
.
find
(
new
CompanyProductQuery
().
productId
(
Long
.
parseLong
(
item
))).
stream
().
map
(
i
->
i
.
getId
()).
toArray
(
Long
[]::
new
);
List
<
Long
>
companyList
=
Arrays
.
asList
(
entity
.
getCompanyId
().
split
(
","
)).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
companyProductRemoveIds
))
{
companyProductService
.
remove
(
companyProductRemoveIds
,
context
);
CompanyProductQuery
companyProductQuery
=
new
CompanyProductQuery
();
}
companyProductQuery
.
setProductId
(
entity
.
getId
());
CompanyEntity
companyEntity
=
companyService
.
get
(
Long
.
parseLong
(
item
),
context
);
companyProductQuery
.
setCompanyIdList
(
companyList
);
Long
[]
companyProductRemoveIds
=
companyProductService
.
find
(
companyProductQuery
).
stream
().
map
(
i
->
i
.
getId
()).
toArray
(
Long
[]::
new
);
if
(!
ObjectUtils
.
isEmpty
(
companyProductRemoveIds
))
{
companyProductService
.
remove
(
companyProductRemoveIds
,
context
);
}
List
<
CompanyProductEntity
>
companyProductList
=
companyList
.
stream
().
map
(
item
->
{
CompanyEntity
companyEntity
=
companyService
.
get
(
item
,
context
);
CompanyProductEntity
companyProductEntity
=
new
CompanyProductEntity
();
CompanyProductEntity
companyProductEntity
=
new
CompanyProductEntity
();
companyProductEntity
.
initAttrValue
();
companyProductEntity
.
initAttrValue
();
companyProductEntity
.
setProductId
(
entity
.
getId
());
companyProductEntity
.
setProductId
(
entity
.
getId
());
...
@@ -241,13 +249,18 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
...
@@ -241,13 +249,18 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
}
}
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
()))
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
()))
{
List
<
ProductCategoryEntity
>
productCategoryList
=
Arrays
.
asList
(
entity
.
getCategoryId
().
split
(
","
)).
stream
().
map
(
item
->
{
List
<
Long
>
categoryList
=
Arrays
.
asList
(
entity
.
getCategoryId
().
split
(
","
)).
stream
().
map
(
i
->
Long
.
parseLong
(
i
)).
collect
(
Collectors
.
toList
());
Long
[]
productCategoryRemoveIds
=
productCategoryService
.
find
(
new
ProductCategoryQuery
().
productId
(
Long
.
parseLong
(
item
))).
stream
().
map
(
i
->
i
.
getId
()).
toArray
(
Long
[]::
new
);
ProductCategoryQuery
productCategoryQuery
=
new
ProductCategoryQuery
();
if
(!
ObjectUtils
.
isEmpty
(
productCategoryRemoveIds
))
{
productCategoryQuery
.
setProductId
(
entity
.
getId
());
productCategoryService
.
remove
(
productCategoryRemoveIds
,
context
);
productCategoryQuery
.
setCategoryIdList
(
categoryList
);
}
Long
[]
productCategoryRemoveIds
=
productCategoryService
.
find
(
productCategoryQuery
).
stream
().
map
(
i
->
i
.
getId
()).
toArray
(
Long
[]::
new
);
if
(!
ObjectUtils
.
isEmpty
(
productCategoryRemoveIds
))
{
productCategoryService
.
remove
(
productCategoryRemoveIds
,
context
);
}
CategoryEntity
categoryEntity
=
categoryService
.
get
(
Long
.
parseLong
(
item
),
context
);
List
<
ProductCategoryEntity
>
productCategoryList
=
categoryList
.
stream
().
map
(
item
->
{
CategoryEntity
categoryEntity
=
categoryService
.
get
(
item
,
context
);
ProductCategoryEntity
productCategoryEntity
=
new
ProductCategoryEntity
();
ProductCategoryEntity
productCategoryEntity
=
new
ProductCategoryEntity
();
productCategoryEntity
.
initAttrValue
();
productCategoryEntity
.
initAttrValue
();
productCategoryEntity
.
setProductId
(
entity
.
getId
());
productCategoryEntity
.
setProductId
(
entity
.
getId
());
...
@@ -272,8 +285,6 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
...
@@ -272,8 +285,6 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
protected
void
removeAfter
(
Long
[]
ids
,
Context
context
,
int
result
)
throws
AppException
{
protected
void
removeAfter
(
Long
[]
ids
,
Context
context
,
int
result
)
throws
AppException
{
List
<
ProductQuestionEntity
>
productQuestionlist
=
productQuestionService
.
find
(
new
ProductQuestionQuery
().
productIdList
(
Arrays
.
asList
(
ids
)));
List
<
ProductQuestionEntity
>
productQuestionlist
=
productQuestionService
.
find
(
new
ProductQuestionQuery
().
productIdList
(
Arrays
.
asList
(
ids
)));
productQuestionService
.
removeList
(
productQuestionlist
,
context
);
productQuestionService
.
removeList
(
productQuestionlist
,
context
);
super
.
removeAfter
(
ids
,
context
,
result
);
super
.
removeAfter
(
ids
,
context
,
result
);
}
}
}
}
\ No newline at end of file
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