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
7 years ago
Commit
a7f97c0618e0e0ad4598882ddc3fbfb8b3126815
1 parent
447569c8
库存管理
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
145 additions
and
35 deletions
dal/src/main/java/com/yoho/ufo/dal/StoragePriceMapper.java
dal/src/main/java/com/yoho/ufo/dal/model/Product.java
dal/src/main/java/com/yoho/ufo/dal/model/StoragePrice.java
dal/src/main/resources/META-INF/mybatis/ProductMapper.xml
dal/src/main/resources/META-INF/mybatis/StoragePriceMapper.xml
product/src/main/java/com/yoho/ufo/convert/ProductConvertService.java
product/src/main/java/com/yoho/ufo/service/impl/StoragePriceService.java
product/src/main/java/com/yoho/ufo/service/impl/StorageService.java
web/src/main/webapp/html/goods/storage/storageList.html
dal/src/main/java/com/yoho/ufo/dal/StoragePriceMapper.java
View file @
a7f97c0
...
...
@@ -44,4 +44,7 @@ public interface StoragePriceMapper {
// 查询状态可售的skup集合
List
<
StoragePrice
>
selectByProductIds
(
@Param
(
"list"
)
List
<
Integer
>
productIdList
);
// 根据SKup等信息查询其所属productId列表 最多查询出最新的300 productId
List
<
Integer
>
selectProductIdsBySkupInfo
(
@Param
(
"storagePrice"
)
StoragePrice
storagePrice
);
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/ufo/dal/model/Product.java
View file @
a7f97c0
package
com
.
yoho
.
ufo
.
dal
.
model
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
Product
{
private
Integer
id
;
...
...
@@ -42,46 +43,18 @@ public class Product {
// 0未删除 1已删除
private
Integer
delStatus
;
public
Integer
getStorageId
()
{
return
storageId
;
}
public
void
setStorageId
(
Integer
storageId
)
{
this
.
storageId
=
storageId
;
}
public
Integer
getSellerUid
()
{
return
sellerUid
;
}
public
void
setSellerUid
(
Integer
sellerUid
)
{
this
.
sellerUid
=
sellerUid
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Integer
getSkup
()
{
return
skup
;
}
public
void
setSkup
(
Integer
skup
)
{
this
.
skup
=
skup
;
}
private
Integer
storageId
;
private
Integer
sellerUid
;
private
Integer
status
;
private
Integer
storageNum
;
private
Integer
skup
;
private
List
<
Integer
>
productIdList
;
public
Integer
getId
()
{
return
id
;
}
...
...
@@ -233,4 +206,52 @@ public class Product {
public
void
setDelStatus
(
Integer
delStatus
)
{
this
.
delStatus
=
delStatus
;
}
public
Integer
getStorageId
()
{
return
storageId
;
}
public
void
setStorageId
(
Integer
storageId
)
{
this
.
storageId
=
storageId
;
}
public
Integer
getSellerUid
()
{
return
sellerUid
;
}
public
void
setSellerUid
(
Integer
sellerUid
)
{
this
.
sellerUid
=
sellerUid
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Integer
getSkup
()
{
return
skup
;
}
public
void
setSkup
(
Integer
skup
)
{
this
.
skup
=
skup
;
}
public
Integer
getStorageNum
()
{
return
storageNum
;
}
public
void
setStorageNum
(
Integer
storageNum
)
{
this
.
storageNum
=
storageNum
;
}
public
List
<
Integer
>
getProductIdList
()
{
return
productIdList
;
}
public
void
setProductIdList
(
List
<
Integer
>
productIdList
)
{
this
.
productIdList
=
productIdList
;
}
}
\ No newline at end of file
...
...
dal/src/main/java/com/yoho/ufo/dal/model/StoragePrice.java
View file @
a7f97c0
package
com
.
yoho
.
ufo
.
dal
.
model
;
import
com.alibaba.fastjson.JSONObject
;
import
java.math.BigDecimal
;
public
class
StoragePrice
{
...
...
@@ -122,4 +124,9 @@ public class StoragePrice {
public
void
setSizeId
(
Integer
sizeId
)
{
this
.
sizeId
=
sizeId
;
}
@Override
public
String
toString
()
{
return
JSONObject
.
toJSONString
(
this
);
}
}
\ No newline at end of file
...
...
dal/src/main/resources/META-INF/mybatis/ProductMapper.xml
View file @
a7f97c0
...
...
@@ -201,5 +201,11 @@
<if
test=
"product.brandId != null and product.brandId > 0"
>
and p.brand_id = #{product.brandId}
</if>
<if
test=
"product.productIdList != null and product.productIdList.size()>0"
>
And b.id in
<foreach
collection=
"product.productIdList"
item=
"productID"
open=
"("
close=
")"
separator=
","
>
#{productID}
</foreach>
</if>
</sql>
</mapper>
\ No newline at end of file
...
...
dal/src/main/resources/META-INF/mybatis/StoragePriceMapper.xml
View file @
a7f97c0
...
...
@@ -148,4 +148,17 @@
#{item}
</foreach>
limit 5000
<!-- 防止太多的数据,导致内存扛不住 -->
</select>
<select
id=
"selectProductIdsBySkupInfo"
resultType=
"java.lang.Integer"
>
select DISTINCT product_id from storage_price where 1 = 1
<if
test=
"storagePrice.sellerUid != null and storagePrice.sellerUid > 0"
>
and seller_uid = #{storagePrice.sellerUid}
</if>
<if
test=
"storagePrice.storageId != null and storagePrice.storageId > 0"
>
and storage_id = #{storagePrice.storageId}
</if>
<if
test=
"storagePrice.skup != null and storagePrice.skup > 0"
>
and skup = #{storagePrice.skup}
</if>
order by create_time desc limit 300
</select>
</mapper>
\ No newline at end of file
...
...
product/src/main/java/com/yoho/ufo/convert/ProductConvertService.java
View file @
a7f97c0
...
...
@@ -59,4 +59,15 @@ public class ProductConvertService {
bo
.
setProductName
(
productItem
.
getProductName
());
return
bo
;
}
public
StoragePrice
convertProduct2Skup
(
Product
product
)
{
StoragePrice
storagePrice
=
new
StoragePrice
();
if
(
null
==
product
)
{
return
storagePrice
;
}
storagePrice
.
setSkup
(
product
.
getSkup
());
storagePrice
.
setStorageId
(
product
.
getStorageId
());
storagePrice
.
setSellerUid
(
product
.
getSellerUid
());
return
storagePrice
;
}
}
...
...
product/src/main/java/com/yoho/ufo/service/impl/StoragePriceService.java
0 → 100644
View file @
a7f97c0
package
com
.
yoho
.
ufo
.
service
.
impl
;
import
com.google.common.collect.Lists
;
import
com.yoho.ufo.convert.ProductConvertService
;
import
com.yoho.ufo.dal.StoragePriceMapper
;
import
com.yoho.ufo.dal.model.Product
;
import
com.yoho.ufo.dal.model.StoragePrice
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* Created by li.ma on 2018/9/20.
*/
@Service
public
class
StoragePriceService
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
StoragePriceService
.
class
);
@Autowired
private
StoragePriceMapper
storagePriceMapper
;
@Autowired
private
ProductConvertService
productConvertService
;
public
List
<
Integer
>
selectProductIdBySkupInfo
(
Product
product
)
{
if
(
null
==
product
||
(
null
==
product
.
getStorageId
()
&&
null
==
product
.
getSkup
()
&&
null
==
product
.
getSellerUid
()))
{
return
Lists
.
newArrayList
();
}
StoragePrice
storagePrice
=
productConvertService
.
convertProduct2Skup
(
product
);
List
<
Integer
>
productIds
=
storagePriceMapper
.
selectProductIdsBySkupInfo
(
storagePrice
);
LOGGER
.
info
(
"result selectProductIdBySkupInfo is {}, storagePrice is {}"
,
productIds
,
storagePrice
);
return
CollectionUtils
.
isEmpty
(
productIds
)
?
Lists
.
newArrayList
()
:
productIds
;
}
}
...
...
product/src/main/java/com/yoho/ufo/service/impl/StorageService.java
View file @
a7f97c0
...
...
@@ -36,6 +36,9 @@ public class StorageService {
private
StoragePriceMapper
storagePriceMapper
;
@Autowired
private
StoragePriceService
storagePriceService
;
@Autowired
private
ProductMapper
productMapper
;
@Autowired
...
...
@@ -46,6 +49,10 @@ public class StorageService {
LOGGER
.
info
(
"StorageService storageList param = {}"
,
bo
);
Product
product
=
OrikaUtils
.
map
(
bo
,
Product
.
class
);
// 如果查询条件含storage_price,先根据条件查询出productId列表 ,再到product表中联合查询
product
.
setProductIdList
(
storagePriceService
.
selectProductIdBySkupInfo
(
product
));
int
count
=
productMapper
.
selectProductStorageCount
(
product
);
if
(
count
==
0
)
{
LOGGER
.
warn
(
"StorageService storageList count is 0.param = {}"
,
bo
);
...
...
web/src/main/webapp/html/goods/storage/storageList.html
View file @
a7f97c0
...
...
@@ -7,7 +7,7 @@
<script
src=
"/ufoPlatform/js/ajaxfileupload.js"
></script>
</head>
<body
class=
"easyui-layout"
fit=
"true"
>
<div
region=
"north"
style=
"height:
19
0px"
>
<div
region=
"north"
style=
"height:
22
0px"
>
<script>
document
.
write
(
addHead
(
'商品库存信息'
,
''
));
</script>
...
...
@@ -204,10 +204,10 @@
var
skup
=
$
(
'#skup'
).
textbox
(
'getValue'
);
var
param
=
{};
if
(
undefined
!==
brandName
&&
null
!==
brandName
&&
""
!==
brandName
)
{
param
.
brand
Name
=
brandName
;
param
.
brand
Id
=
brandName
;
}
if
(
undefined
!==
storageNum
&&
null
!==
storageNum
&&
""
!==
storageNum
)
{
param
.
storage
=
storageNum
;
param
.
storage
Num
=
storageNum
;
}
if
(
undefined
!==
id
&&
null
!==
id
&&
""
!==
id
)
{
param
.
id
=
id
;
...
...
Please
register
or
login
to post a comment