Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ufo
/
ufo-platform
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
mali
6 years ago
Commit
b02005853a810f9f2fcb3cfba4b97fa768ab07b1
1 parent
39840901
批量导入商品接口
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
product/src/main/java/com/yoho/ufo/controller/ProductController.java
product/src/main/java/com/yoho/ufo/service/IProductService.java
product/src/main/java/com/yoho/ufo/service/impl/ProductServiceImpl.java
product/src/main/java/com/yoho/ufo/controller/ProductController.java
View file @
b020058
...
...
@@ -29,7 +29,7 @@ public class ProductController {
@RequestMapping
(
value
=
"/addOrUpdate"
)
public
ApiResponse
<
Void
>
addOrUpdate
(
@RequestBody
ProductRequestBo
bo
)
{
LOGGER
.
info
(
"product.addOrUpdate param = {}"
,
bo
);
return
productService
.
addOrUpdate
(
bo
);
return
productService
.
addOrUpdate
(
bo
,
true
);
}
/** 基础商品创建 - 编辑查询 */
...
...
product/src/main/java/com/yoho/ufo/service/IProductService.java
View file @
b020058
...
...
@@ -10,7 +10,7 @@ import com.yohobuy.ufo.model.resp.product.ProductResponceBo;
public
interface
IProductService
{
ApiResponse
<
Void
>
addOrUpdate
(
ProductRequestBo
bo
);
ApiResponse
<
Void
>
addOrUpdate
(
ProductRequestBo
bo
,
boolean
isCheckUrl
);
ApiResponse
<
ProductEditResponceBo
>
findProductDetailById
(
Integer
id
);
...
...
product/src/main/java/com/yoho/ufo/service/impl/ProductServiceImpl.java
View file @
b020058
...
...
@@ -78,8 +78,8 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
@Autowired
private
UfoBrandSeriesMapper
brandSeriesMapper
;
@Override
public
ApiResponse
<
Void
>
addOrUpdate
(
ProductRequestBo
bo
)
{
checkProductInfo
(
bo
);
public
ApiResponse
<
Void
>
addOrUpdate
(
ProductRequestBo
bo
,
boolean
isCheckUrl
)
{
checkProductInfo
(
bo
,
isCheckUrl
);
Product
product
=
getProductFromBo
(
bo
);
Goods
goods
=
getGoodsFromBo
(
bo
);
List
<
Storage
>
storageList
=
getStoragesFromBo
(
bo
);
...
...
@@ -189,7 +189,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
return
p
;
}
private
void
checkProductInfo
(
ProductRequestBo
bo
)
{
private
void
checkProductInfo
(
ProductRequestBo
bo
,
boolean
isCheckUrl
)
{
if
(
bo
.
getBrandId
()
==
null
||
bo
.
getBrandId
()
<
1
)
{
throw
new
CommonException
(
400
,
"请选择品牌"
);
}
...
...
@@ -238,7 +238,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
if
((
bo
.
getId
()
==
null
||
bo
.
getId
()
<
1
)
&&
CollectionUtils
.
isEmpty
(
bo
.
getSizeIdList
()))
{
throw
new
CommonException
(
400
,
"请选择至少选择一个尺寸"
);
}
if
(
CollectionUtils
.
isEmpty
(
bo
.
getImageUrlList
()))
{
if
(
isCheckUrl
&&
CollectionUtils
.
isEmpty
(
bo
.
getImageUrlList
()))
{
throw
new
CommonException
(
400
,
"请上传至少一张图片"
);
}
}
...
...
@@ -675,7 +675,7 @@ public static void main(String[] args) {
bo1
.
setSizeIdList
(
sizeIdList
);
addOrUpdate
(
bo1
);
addOrUpdate
(
bo1
,
false
);
return
new
ApiResponse
<>(
200
,
"操作成功!"
);
...
...
Please
register
or
login
to post a comment