Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-shopmall-parent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b55c20a6
authored
Apr 12, 2023
by
黄超华
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
商品相关信息查询的bug修改和单元测试
1 parent
7b78fce1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
13 deletions
platform-shopmall-api/src/main/java/cn/com/glsx/admin/modules/entity/Goods.java
platform-shopmall-api/src/main/java/cn/com/glsx/admin/modules/model/cloudcrane/response/QueryGoodsDetailResponse.java
platform-shopmall/src/main/java/cn/com/glsx/admin/modules/service/GoodsService.java
platform-shopmall/src/main/resources/mapper/GoodsImageMapper.xml
platform-shopmall/src/main/resources/mapper/GoodsMapper.xml
platform-shopmall/src/test/java/cn/com/glsx/admin/modules/service/GoodsServiceTest.java
platform-shopmall-api/src/main/java/cn/com/glsx/admin/modules/entity/Goods.java
View file @
b55c20a
...
@@ -182,7 +182,7 @@ public class Goods extends BaseEntity {
...
@@ -182,7 +182,7 @@ public class Goods extends BaseEntity {
* 商品毛重
* 商品毛重
*/
*/
@Column
(
name
=
"gross_weight"
)
@Column
(
name
=
"gross_weight"
)
private
Integer
grossWeight
;
private
Double
grossWeight
;
/**
/**
* 商品毛重计量单位(g,kg)
* 商品毛重计量单位(g,kg)
...
@@ -193,7 +193,7 @@ public class Goods extends BaseEntity {
...
@@ -193,7 +193,7 @@ public class Goods extends BaseEntity {
/**
/**
* 商品密度(g/cm3)
* 商品密度(g/cm3)
*/
*/
private
Integer
density
;
private
Double
density
;
/**
/**
* 商品长(含包装,单位 mm)
* 商品长(含包装,单位 mm)
...
...
platform-shopmall-api/src/main/java/cn/com/glsx/admin/modules/model/cloudcrane/response/QueryGoodsDetailResponse.java
View file @
b55c20a
...
@@ -16,7 +16,7 @@ public class QueryGoodsDetailResponse extends AbstractCloudCraneResponse {
...
@@ -16,7 +16,7 @@ public class QueryGoodsDetailResponse extends AbstractCloudCraneResponse {
private
Integer
startQty
;
private
Integer
startQty
;
private
Integer
shelvesStatus
;
private
Integer
shelvesStatus
;
private
String
taxCode
;
private
String
taxCode
;
private
Double
taxRate
;
private
Float
taxRate
;
private
String
barCode
;
private
String
barCode
;
private
Integer
isDeleted
;
private
Integer
isDeleted
;
private
String
brandCode
;
private
String
brandCode
;
...
@@ -27,7 +27,7 @@ public class QueryGoodsDetailResponse extends AbstractCloudCraneResponse {
...
@@ -27,7 +27,7 @@ public class QueryGoodsDetailResponse extends AbstractCloudCraneResponse {
private
String
secondCategoryName
;
private
String
secondCategoryName
;
private
String
lastCategoryCode
;
private
String
lastCategoryCode
;
private
String
lastCategoryName
;
private
String
lastCategoryName
;
private
Long
returnGoodsRules
;
private
Integer
returnGoodsRules
;
private
String
goodsCharacteristic
;
private
String
goodsCharacteristic
;
private
String
goodsUnit
;
private
String
goodsUnit
;
private
String
modelNumber
;
private
String
modelNumber
;
...
...
platform-shopmall/src/main/java/cn/com/glsx/admin/modules/service/GoodsService.java
View file @
b55c20a
...
@@ -53,7 +53,7 @@ public class GoodsService {
...
@@ -53,7 +53,7 @@ public class GoodsService {
*/
*/
public
PageInfo
<
GoodsSkuListItem
>
queryGoodsList
(
QueryGoodsListRequest
req
)
{
public
PageInfo
<
GoodsSkuListItem
>
queryGoodsList
(
QueryGoodsListRequest
req
)
{
Page
<
GoodsSkuListItem
>
pages
=
PageHelper
.
startPage
(
req
.
getPageNum
(),
req
.
getPageSize
());
Page
<
GoodsSkuListItem
>
pages
=
PageHelper
.
startPage
(
req
.
getPageNum
(),
req
.
getPageSize
());
goodsMapper
.
queryGoodsList
();
List
<
GoodsSkuListItem
>
list
=
goodsMapper
.
queryGoodsList
();
// cloudCraneService.queryGoodsList(req);
// cloudCraneService.queryGoodsList(req);
return
new
PageInfo
(
pages
);
return
new
PageInfo
(
pages
);
}
}
...
@@ -84,7 +84,26 @@ public class GoodsService {
...
@@ -84,7 +84,26 @@ public class GoodsService {
public
List
<
QueryGoodsDetailResponse
>
queryGoodsDetail
(
List
<
String
>
goodsSkuCodes
)
{
public
List
<
QueryGoodsDetailResponse
>
queryGoodsDetail
(
List
<
String
>
goodsSkuCodes
)
{
Assert
.
notEmpty
(
goodsSkuCodes
,
"goodsSkuCodes can not be null."
);
Assert
.
notEmpty
(
goodsSkuCodes
,
"goodsSkuCodes can not be null."
);
// cloudCraneService.queryGoodsDetail(goodsSkuCodes);
// cloudCraneService.queryGoodsDetail(goodsSkuCodes);
return
goodsMapper
.
queryGoodsDetail
(
goodsSkuCodes
);
List
<
QueryGoodsDetailResponse
>
goodsList
=
goodsMapper
.
queryGoodsDetail
(
goodsSkuCodes
);
//补齐列表的GoodsSkuCode字段
goodsList
.
forEach
(
goodsItem
->{
if
(
CollectionUtils
.
isNotEmpty
(
goodsItem
.
getSpecList
())){
goodsItem
.
getSpecList
().
forEach
(
specListItem
->
{
specListItem
.
setGoodsSkuCode
(
goodsItem
.
getGoodsSkuCode
());
});
}
if
(
CollectionUtils
.
isNotEmpty
(
goodsItem
.
getGoodsImageList
())){
goodsItem
.
getGoodsImageList
().
forEach
(
imageItem
->
{
imageItem
.
setGoodsSkuCode
(
goodsItem
.
getGoodsSkuCode
());
});
}
if
(
CollectionUtils
.
isNotEmpty
(
goodsItem
.
getAttributeList
())){
goodsItem
.
getAttributeList
().
forEach
(
attributeItem
->
{
attributeItem
.
setGoodsSkuCode
(
goodsItem
.
getGoodsSkuCode
());
});
}
});
return
goodsList
;
}
}
/**
/**
...
@@ -97,7 +116,13 @@ public class GoodsService {
...
@@ -97,7 +116,13 @@ public class GoodsService {
*/
*/
public
List
<
QueryGoodsImageListResponse
>
queryGoodsImageList
(
List
<
String
>
goodsSkuCodes
)
{
public
List
<
QueryGoodsImageListResponse
>
queryGoodsImageList
(
List
<
String
>
goodsSkuCodes
)
{
// cloudCraneService.queryGoodsImageList(goodsSkuCodes);
// cloudCraneService.queryGoodsImageList(goodsSkuCodes);
return
goodsImageMapper
.
queryGoodsImageList
(
goodsSkuCodes
);
List
<
QueryGoodsImageListResponse
>
goodsImageList
=
goodsImageMapper
.
queryGoodsImageList
(
goodsSkuCodes
);
goodsImageList
.
forEach
(
item
->{
item
.
getImageList
().
forEach
(
imageItem
->
{
imageItem
.
setGoodsSkuCode
(
item
.
getGoodsSkuCode
());
});
});
return
goodsImageList
;
}
}
/**
/**
...
...
platform-shopmall/src/main/resources/mapper/GoodsImageMapper.xml
View file @
b55c20a
...
@@ -27,8 +27,7 @@
...
@@ -27,8 +27,7 @@
<resultMap
id=
"GoodsImageListResultMap"
<resultMap
id=
"GoodsImageListResultMap"
type=
"cn.com.glsx.admin.modules.model.cloudcrane.response.QueryGoodsImageListResponse"
>
type=
"cn.com.glsx.admin.modules.model.cloudcrane.response.QueryGoodsImageListResponse"
>
<result
column=
"goods_sku_code"
jdbcType=
"VARCHAR"
property=
"goodsSkuCode"
/>
<result
column=
"goods_sku_code"
jdbcType=
"VARCHAR"
property=
"goodsSkuCode"
/>
<collection
property=
"imageList"
<collection
property=
"imageList"
ofType=
"cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsImageListItem"
>
javaType=
"cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsImageListItem"
>
<result
column=
"img_url"
jdbcType=
"VARCHAR"
property=
"imgUrl"
/>
<result
column=
"img_url"
jdbcType=
"VARCHAR"
property=
"imgUrl"
/>
<result
column=
"img_main"
jdbcType=
"INTEGER"
property=
"imgMain"
/>
<result
column=
"img_main"
jdbcType=
"INTEGER"
property=
"imgMain"
/>
<result
column=
"img_sort"
jdbcType=
"INTEGER"
property=
"imgSort"
/>
<result
column=
"img_sort"
jdbcType=
"INTEGER"
property=
"imgSort"
/>
...
...
platform-shopmall/src/main/resources/mapper/GoodsMapper.xml
View file @
b55c20a
...
@@ -34,9 +34,9 @@
...
@@ -34,9 +34,9 @@
<result
column=
"have_shelf_life"
jdbcType=
"INTEGER"
property=
"haveShelfLife"
/>
<result
column=
"have_shelf_life"
jdbcType=
"INTEGER"
property=
"haveShelfLife"
/>
<result
column=
"shelf_life"
jdbcType=
"VARCHAR"
property=
"shelfLife"
/>
<result
column=
"shelf_life"
jdbcType=
"VARCHAR"
property=
"shelfLife"
/>
<result
column=
"fragile_goods"
jdbcType=
"INTEGER"
property=
"fragileGoods"
/>
<result
column=
"fragile_goods"
jdbcType=
"INTEGER"
property=
"fragileGoods"
/>
<result
column=
"gross_weight"
jdbcType=
"
INTEGER
"
property=
"grossWeight"
/>
<result
column=
"gross_weight"
jdbcType=
"
DOUBLE
"
property=
"grossWeight"
/>
<result
column=
"gross_weight_unit"
jdbcType=
"VARCHAR"
property=
"grossWeightUnit"
/>
<result
column=
"gross_weight_unit"
jdbcType=
"VARCHAR"
property=
"grossWeightUnit"
/>
<result
column=
"density"
jdbcType=
"
INTEGER
"
property=
"density"
/>
<result
column=
"density"
jdbcType=
"
DOUBLE
"
property=
"density"
/>
<result
column=
"extent"
jdbcType=
"INTEGER"
property=
"extent"
/>
<result
column=
"extent"
jdbcType=
"INTEGER"
property=
"extent"
/>
<result
column=
"width"
jdbcType=
"INTEGER"
property=
"width"
/>
<result
column=
"width"
jdbcType=
"INTEGER"
property=
"width"
/>
<result
column=
"height"
jdbcType=
"INTEGER"
property=
"height"
/>
<result
column=
"height"
jdbcType=
"INTEGER"
property=
"height"
/>
...
@@ -68,11 +68,13 @@
...
@@ -68,11 +68,13 @@
<association
property=
"descDetail"
javaType=
"cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsDescDetailModel"
>
<association
property=
"descDetail"
javaType=
"cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsDescDetailModel"
>
<result
column=
"goods_describe"
jdbcType=
"VARCHAR"
property=
"goodsDescribe"
/>
<result
column=
"goods_describe"
jdbcType=
"VARCHAR"
property=
"goodsDescribe"
/>
</association>
</association>
<collection
property=
"specList"
javaType=
"cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsSpecListItem"
>
<collection
property=
"specList"
ofType=
"cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsSpecListItem"
>
<result
column=
"goods_sku_code"
jdbcType=
"VARCHAR"
property=
"goodsSkuCode"
/>
<result
column=
"spec_name"
jdbcType=
"VARCHAR"
property=
"specName"
/>
<result
column=
"spec_name"
jdbcType=
"VARCHAR"
property=
"specName"
/>
<result
column=
"spec_value"
jdbcType=
"VARCHAR"
property=
"specValue"
/>
<result
column=
"spec_value"
jdbcType=
"VARCHAR"
property=
"specValue"
/>
</collection>
</collection>
<collection
property=
"attributeList"
javaType=
"cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsAttributeListItem"
>
<collection
property=
"attributeList"
ofType=
"cn.com.glsx.admin.modules.model.cloudcrane.response.GoodsAttributeListItem"
>
<result
column=
"goods_sku_code"
jdbcType=
"VARCHAR"
property=
"goodsSkuCode"
/>
<result
column=
"attribute_code"
jdbcType=
"VARCHAR"
property=
"attributeCode"
/>
<result
column=
"attribute_code"
jdbcType=
"VARCHAR"
property=
"attributeCode"
/>
<result
column=
"attribute_name"
jdbcType=
"VARCHAR"
property=
"attributeName"
/>
<result
column=
"attribute_name"
jdbcType=
"VARCHAR"
property=
"attributeName"
/>
<result
column=
"attribute_value_code"
jdbcType=
"VARCHAR"
property=
"attributeValueCode"
/>
<result
column=
"attribute_value_code"
jdbcType=
"VARCHAR"
property=
"attributeValueCode"
/>
...
...
platform-shopmall/src/test/java/cn/com/glsx/admin/modules/service/GoodsServiceTest.java
0 → 100644
View file @
b55c20a
package
cn
.
com
.
glsx
.
admin
.
modules
.
service
;
import
cn.com.glsx.Application
;
import
cn.com.glsx.admin.modules.model.cloudcrane.request.QueryGoodsListByConditionRequest
;
import
cn.com.glsx.admin.modules.model.cloudcrane.request.QueryGoodsListRequest
;
import
cn.com.glsx.admin.modules.model.cloudcrane.response.QueryGoodsDetailResponse
;
import
org.assertj.core.util.Lists
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.List
;
/**
* @author huangch
* @version V1.0
* @Title: GoodsServiceTest
* @Description:
* @Company: Didihu.com.cn
* @Date 2023/4/12 17:15
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
{
Application
.
class
})
public
class
GoodsServiceTest
{
@Autowired
private
GoodsService
goodsService
;
@Test
public
void
testQueryGoodsList
(){
System
.
out
.
println
(
goodsService
.
queryGoodsList
(
QueryGoodsListRequest
.
builder
().
pageNum
(
1
).
pageSize
(
100
).
build
()));
}
@Test
public
void
testQueryGoodsListByCondition
(){
System
.
out
.
println
(
goodsService
.
queryGoodsListByCondition
(
QueryGoodsListByConditionRequest
.
builder
().
pageNum
(
1
).
pageSize
(
100
).
startSellPrice
(
4000.0
).
build
()));
}
@Test
public
void
testQueryGoodsInfo
(){
List
<
String
>
goodsSkuCodes
=
Lists
.
newArrayList
(
"2888888889074982"
,
"2888888889144503"
);
List
<
QueryGoodsDetailResponse
>
goodsDetailList
=
goodsService
.
queryGoodsDetail
(
goodsSkuCodes
);
System
.
out
.
println
(
goodsDetailList
);
System
.
out
.
println
(
goodsService
.
queryGoodsImageList
(
goodsSkuCodes
));
System
.
out
.
println
(
goodsService
.
queryGoodsShelvesList
(
goodsSkuCodes
));
System
.
out
.
println
(
goodsService
.
queryGoodsPriceList
(
goodsSkuCodes
));
System
.
out
.
println
(
goodsService
.
queryGoodsStockList
(
goodsSkuCodes
));
System
.
out
.
println
(
goodsService
.
queryGoodsSaleLimitList
(
goodsSkuCodes
));
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment