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
0dbaf26b
Commit
0dbaf26b
authored
Sep 28, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加修改产品规划
parent
451436a6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
126 additions
and
17 deletions
+126
-17
enterprise-manager-ui/admin/src/assets/mixins/table.js
enterprise-manager-ui/admin/src/assets/mixins/table.js
+1
-0
enterprise-manager-ui/admin/src/views/product/drawershow.vue
enterprise-manager-ui/admin/src/views/product/drawershow.vue
+15
-2
enterprise-manager-ui/admin/src/views/product/list.vue
enterprise-manager-ui/admin/src/views/product/list.vue
+1
-1
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
...s/xhx/module/product/service/impl/ProductServiceImpl.java
+109
-14
No files found.
enterprise-manager-ui/admin/src/assets/mixins/table.js
View file @
0dbaf26b
...
@@ -158,6 +158,7 @@ export default {
...
@@ -158,6 +158,7 @@ export default {
formatterYES
(
row
,
column
,
val
)
{
formatterYES
(
row
,
column
,
val
)
{
const
content
=
formatter
(
this
.
tableData
,
column
,
val
);
const
content
=
formatter
(
this
.
tableData
,
column
,
val
);
console
.
log
(
"
content
"
,
content
)
if
(
content
)
{
if
(
content
)
{
if
(
val
==
'
0
'
)
{
if
(
val
==
'
0
'
)
{
return
<
el
-
tag
type
=
{
'
danger
'
}
size
=
'
mini
'
>
{
content
}
<
/el-tag
>
return
<
el
-
tag
type
=
{
'
danger
'
}
size
=
'
mini
'
>
{
content
}
<
/el-tag
>
...
...
enterprise-manager-ui/admin/src/views/product/drawershow.vue
View file @
0dbaf26b
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
<Field
label=
"产品编码"
prop=
"productCode"
v-model=
"form.productCode"
type=
"textarea"
placeholder=
"请输入产品编码"
/>
<Field
label=
"产品编码"
prop=
"productCode"
v-model=
"form.productCode"
type=
"textarea"
placeholder=
"请输入产品编码"
/>
<Field
label=
"产品slogan"
prop=
"productSlogan"
v-model=
"form.productSlogan"
placeholder=
"请输入产品slogan"
/>
<Field
label=
"产品slogan"
prop=
"productSlogan"
v-model=
"form.productSlogan"
placeholder=
"请输入产品slogan"
/>
<Field
label=
"产品分类"
prop=
"categoryId"
v-model=
"form.categoryId"
:multiple=
"true"
type=
"select"
placeholder=
"请选择产品分类"
/>
<Field
label=
"产品分类"
prop=
"categoryId"
v-model=
"form.categoryId"
:multiple=
"true"
type=
"select"
:enumData=
"dict.categoryId"
placeholder=
"请选择产品分类"
/>
<Field
label=
"所属企业"
prop=
"companyId"
v-model=
"form.companyId"
:multiple=
"true"
type=
"select"
placeholder=
"请选择所属企业"
/>
<Field
label=
"所属企业"
prop=
"companyId"
v-model=
"form.companyId"
:multiple=
"true"
type=
"select"
:enumData=
"dict.companyId"
placeholder=
"请选择所属企业"
/>
<Field
label=
"产品图标"
><imageUpload
v-model=
"form.productLogoPath"
prePath=
"/file/preview"
/></Field>
<Field
label=
"产品图标"
><imageUpload
v-model=
"form.productLogoPath"
prePath=
"/file/preview"
/></Field>
...
@@ -106,6 +106,10 @@
...
@@ -106,6 +106,10 @@
toString
:[
toString
:[
"
hot
"
,
"
hot
"
,
],
],
toArrays
:[
"
companyId
"
,
"
categoryId
"
],
toDate
:[
toDate
:[
"
publishTime
"
,
"
publishTime
"
,
],
],
...
@@ -212,6 +216,15 @@
...
@@ -212,6 +216,15 @@
this
.
open
=
true
;
this
.
open
=
true
;
},
},
beforeSubmit
(
data
)
{
data
.
categoryId
=
data
.
categoryId
.
join
(
"
,
"
)
data
.
companyId
=
data
.
companyId
.
join
(
"
,
"
)
return
data
},
afterSubmit
(
data
)
{
afterSubmit
(
data
)
{
this
.
open
=
false
;
this
.
open
=
false
;
this
.
$emit
(
"
ok
"
);
this
.
$emit
(
"
ok
"
);
...
...
enterprise-manager-ui/admin/src/views/product/list.vue
View file @
0dbaf26b
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
{
label
:
"
发布时间
"
,
prop
:
"
publishTime
"
,
formatter
:
this
.
formatterDate
},
{
label
:
"
发布时间
"
,
prop
:
"
publishTime
"
,
formatter
:
this
.
formatterDate
},
{
label
:
"
热门
"
,
prop
:
"
hot
"
,
formatter
:
this
.
formatter
},
{
label
:
"
热门
"
,
prop
:
"
hot
"
,
formatter
:
this
.
formatter
YES
},
{
label
:
"
最近更新时间
"
,
prop
:
"
updateTime
"
,
formatter
:
this
.
formatterDate
},
{
label
:
"
最近更新时间
"
,
prop
:
"
updateTime
"
,
formatter
:
this
.
formatterDate
},
...
...
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
View file @
0dbaf26b
package
com.mortals.xhx.module.product.service.impl
;
package
com.mortals.xhx.module.product.service.impl
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.xhx.module.category.model.CategoryEntity
;
import
com.mortals.xhx.module.category.service.CategoryService
;
import
com.mortals.xhx.module.category.service.CategoryService
;
import
com.mortals.xhx.module.company.model.CompanyEntity
;
import
com.mortals.xhx.module.company.model.CompanyProductEntity
;
import
com.mortals.xhx.module.company.model.CompanyProductQuery
;
import
com.mortals.xhx.module.company.model.CompanyProductQuery
;
import
com.mortals.xhx.module.company.service.CompanyProductService
;
import
com.mortals.xhx.module.company.service.CompanyProductService
;
import
com.mortals.xhx.module.company.service.CompanyService
;
import
com.mortals.xhx.module.company.service.CompanyService
;
...
@@ -15,19 +19,21 @@ import com.mortals.xhx.module.product.service.ProductService;
...
@@ -15,19 +19,21 @@ import com.mortals.xhx.module.product.service.ProductService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.mortals.xhx.module.product.service.ProductQuestionService
;
import
com.mortals.xhx.module.product.service.ProductQuestionService
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
/**
/**
* ProductService
* ProductService
* 产品 service实现
* 产品 service实现
*
*
* @author zxfei
* @author zxfei
* @date 2023-09-18
* @date 2023-09-18
*/
*/
@Service
(
"productService"
)
@Service
(
"productService"
)
@Slf4j
@Slf4j
public
class
ProductServiceImpl
extends
AbstractCRUDServiceImpl
<
ProductDao
,
ProductEntity
,
Long
>
implements
ProductService
{
public
class
ProductServiceImpl
extends
AbstractCRUDServiceImpl
<
ProductDao
,
ProductEntity
,
Long
>
implements
ProductService
{
...
@@ -45,10 +51,9 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
...
@@ -45,10 +51,9 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
private
CompanyService
companyService
;
private
CompanyService
companyService
;
@Override
@Override
protected
void
findAfter
(
ProductEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
ProductEntity
>
list
)
throws
AppException
{
protected
void
findAfter
(
ProductEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
ProductEntity
>
list
)
throws
AppException
{
list
.
forEach
(
item
->
{
list
.
forEach
(
item
->
{
String
categoryIds
=
productCategoryService
.
find
(
new
ProductCategoryQuery
().
productId
(
item
.
getId
())).
stream
().
map
(
i
->
i
.
getCategoryId
().
toString
()).
collect
(
Collectors
.
joining
(
","
));
String
categoryIds
=
productCategoryService
.
find
(
new
ProductCategoryQuery
().
productId
(
item
.
getId
())).
stream
().
map
(
i
->
i
.
getCategoryId
().
toString
()).
collect
(
Collectors
.
joining
(
","
));
String
companyIds
=
companyProductService
.
find
(
new
CompanyProductQuery
().
productId
(
item
.
getId
())).
stream
().
map
(
i
->
i
.
getProductId
().
toString
()).
collect
(
Collectors
.
joining
(
","
));
String
companyIds
=
companyProductService
.
find
(
new
CompanyProductQuery
().
productId
(
item
.
getId
())).
stream
().
map
(
i
->
i
.
getProductId
().
toString
()).
collect
(
Collectors
.
joining
(
","
));
item
.
setCompanyId
(
companyIds
);
item
.
setCompanyId
(
companyIds
);
...
@@ -58,8 +63,8 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
...
@@ -58,8 +63,8 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
@Override
@Override
protected
void
saveAfter
(
ProductEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
saveAfter
(
ProductEntity
entity
,
Context
context
)
throws
AppException
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getProductQuestionList
()))
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getProductQuestionList
()))
{
entity
.
getProductQuestionList
().
stream
().
peek
(
item
->
{
entity
.
getProductQuestionList
().
stream
().
peek
(
item
->
{
item
.
setProductId
(
entity
.
getId
());
item
.
setProductId
(
entity
.
getId
());
item
.
setProductName
(
entity
.
getProductName
());
item
.
setProductName
(
entity
.
getProductName
());
item
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
item
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
...
@@ -67,15 +72,54 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
...
@@ -67,15 +72,54 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
}).
count
();
}).
count
();
productQuestionService
.
save
(
entity
.
getProductQuestionList
());
productQuestionService
.
save
(
entity
.
getProductQuestionList
());
}
}
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
List
<
CompanyProductEntity
>
companyProductList
=
Arrays
.
asList
(
entity
.
getCompanyId
().
split
(
","
)).
stream
().
map
(
item
->
{
CompanyEntity
companyEntity
=
companyService
.
get
(
Long
.
parseLong
(
item
),
context
);
CompanyProductEntity
companyProductEntity
=
new
CompanyProductEntity
();
companyProductEntity
.
initAttrValue
();
companyProductEntity
.
setProductId
(
entity
.
getId
());
companyProductEntity
.
setProductName
(
entity
.
getProductName
());
companyProductEntity
.
setCompanyId
(
companyEntity
.
getId
());
companyProductEntity
.
setCompanyName
(
companyEntity
.
getCompanyName
());
companyProductEntity
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
companyProductEntity
.
setCreateTime
(
new
Date
());
return
companyProductEntity
;
}).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
companyProductList
))
{
companyProductService
.
save
(
companyProductList
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
()))
{
List
<
ProductCategoryEntity
>
productCategoryList
=
Arrays
.
asList
(
entity
.
getCategoryId
().
split
(
","
)).
stream
().
map
(
item
->
{
CategoryEntity
categoryEntity
=
categoryService
.
get
(
Long
.
parseLong
(
item
),
context
);
ProductCategoryEntity
productCategoryEntity
=
new
ProductCategoryEntity
();
productCategoryEntity
.
initAttrValue
();
productCategoryEntity
.
setProductId
(
entity
.
getId
());
productCategoryEntity
.
setProductName
(
entity
.
getProductName
());
productCategoryEntity
.
setCategoryId
(
categoryEntity
.
getId
());
productCategoryEntity
.
setCategoryName
(
categoryEntity
.
getName
());
productCategoryEntity
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
productCategoryEntity
.
setCreateTime
(
new
Date
());
return
productCategoryEntity
;
}).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
productCategoryList
))
{
productCategoryService
.
save
(
productCategoryList
);
}
}
super
.
saveAfter
(
entity
,
context
);
super
.
saveAfter
(
entity
,
context
);
}
}
@Override
@Override
protected
void
updateAfter
(
ProductEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
updateAfter
(
ProductEntity
entity
,
Context
context
)
throws
AppException
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getProductQuestionList
()))
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getProductQuestionList
()))
{
Long
[]
productQuestionIds
=
productQuestionService
.
find
(
new
ProductQuestionQuery
().
productId
(
entity
.
getId
())).
stream
().
map
(
ProductQuestionEntity:
:
getId
).
toArray
(
Long
[]::
new
);
Long
[]
productQuestionIds
=
productQuestionService
.
find
(
new
ProductQuestionQuery
().
productId
(
entity
.
getId
())).
stream
().
map
(
ProductQuestionEntity:
:
getId
).
toArray
(
Long
[]::
new
);
productQuestionService
.
remove
(
productQuestionIds
,
context
);
productQuestionService
.
remove
(
productQuestionIds
,
context
);
entity
.
getProductQuestionList
().
stream
().
peek
(
item
->{
entity
.
getProductQuestionList
().
stream
().
peek
(
item
->
{
item
.
setProductId
(
entity
.
getId
());
item
.
setProductId
(
entity
.
getId
());
item
.
setProductName
(
entity
.
getProductName
());
item
.
setProductName
(
entity
.
getProductName
());
item
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
item
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
...
@@ -85,13 +129,64 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
...
@@ -85,13 +129,64 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
}).
count
();
}).
count
();
productQuestionService
.
save
(
entity
.
getProductQuestionList
());
productQuestionService
.
save
(
entity
.
getProductQuestionList
());
}
}
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
);
if
(!
ObjectUtils
.
isEmpty
(
companyProductRemoveIds
))
{
companyProductService
.
remove
(
companyProductRemoveIds
,
context
);
}
CompanyEntity
companyEntity
=
companyService
.
get
(
Long
.
parseLong
(
item
),
context
);
CompanyProductEntity
companyProductEntity
=
new
CompanyProductEntity
();
companyProductEntity
.
initAttrValue
();
companyProductEntity
.
setProductId
(
entity
.
getId
());
companyProductEntity
.
setProductName
(
entity
.
getProductName
());
companyProductEntity
.
setCompanyId
(
companyEntity
.
getId
());
companyProductEntity
.
setCompanyName
(
companyEntity
.
getCompanyName
());
companyProductEntity
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
companyProductEntity
.
setCreateTime
(
new
Date
());
return
companyProductEntity
;
}).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
companyProductList
))
{
companyProductService
.
save
(
companyProductList
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
()))
{
List
<
ProductCategoryEntity
>
productCategoryList
=
Arrays
.
asList
(
entity
.
getCategoryId
().
split
(
","
)).
stream
().
map
(
item
->
{
Long
[]
productCategoryRemoveIds
=
productCategoryService
.
find
(
new
ProductCategoryQuery
().
productId
(
Long
.
parseLong
(
item
))).
stream
().
map
(
i
->
i
.
getId
()).
toArray
(
Long
[]::
new
);
if
(!
ObjectUtils
.
isEmpty
(
productCategoryRemoveIds
))
{
productCategoryService
.
remove
(
productCategoryRemoveIds
,
context
);
}
CategoryEntity
categoryEntity
=
categoryService
.
get
(
Long
.
parseLong
(
item
),
context
);
ProductCategoryEntity
productCategoryEntity
=
new
ProductCategoryEntity
();
productCategoryEntity
.
initAttrValue
();
productCategoryEntity
.
setProductId
(
entity
.
getId
());
productCategoryEntity
.
setProductName
(
entity
.
getProductName
());
productCategoryEntity
.
setCategoryId
(
categoryEntity
.
getId
());
productCategoryEntity
.
setCategoryName
(
categoryEntity
.
getName
());
productCategoryEntity
.
setCreateUserId
(
this
.
getContextUserId
(
context
));
productCategoryEntity
.
setCreateTime
(
new
Date
());
return
productCategoryEntity
;
}).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
productCategoryList
))
{
productCategoryService
.
save
(
productCategoryList
);
}
}
super
.
updateAfter
(
entity
,
context
);
super
.
updateAfter
(
entity
,
context
);
}
}
@Override
@Override
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