Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
ms
soss
Commits
cd42f1bf
Commit
cd42f1bf
authored
Sep 08, 2022
by
caiyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
周度提交
parent
b0471a51
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
86 additions
and
36 deletions
+86
-36
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopRecommendController.java
+18
-20
soss-system/src/main/java/com/soss/system/mapper/OrderDetailMapper.java
+5
-0
soss-system/src/main/java/com/soss/system/service/IGoodsService.java
+2
-0
soss-system/src/main/java/com/soss/system/service/impl/GoodsServiceImpl.java
+26
-2
soss-system/src/main/java/com/soss/system/service/impl/OrderTakingServiceImpl.java
+9
-1
soss-system/src/main/java/com/soss/system/service/impl/ShopRecommendServiceImpl.java
+9
-10
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
+2
-2
soss-system/src/main/resources/mapper/system/OrderDetailMapper.xml
+14
-0
soss-system/src/main/resources/mapper/system/OrderMapper.xml
+1
-1
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopRecommendController.java
View file @
cd42f1bf
package
com
.
soss
.
web
.
controller
.
coffee
;
import
java.util.List
;
import
com.soss.system.domain.Goods
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
com.soss.common.annotation.Log
;
import
com.soss.common.core.controller.BaseController
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.page.TableDataInfo
;
import
com.soss.common.enums.BusinessType
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.ShopRecommend
;
import
com.soss.system.service.IGoodsService
;
import
com.soss.system.service.IShopRecommendService
;
import
com.soss.common.core.page.TableDataInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 推荐和今日特惠Controller
*
*
* @author zxq
* @date 2022-04-28
*/
@RestController
@RequestMapping
(
"/system/recommend"
)
public
class
ShopRecommendController
extends
BaseController
{
public
class
ShopRecommendController
extends
BaseController
{
@Autowired
private
IShopRecommendService
shopRecommendService
;
@Autowired
private
IGoodsService
goodsService
;
@GetMapping
(
"/turn"
)
public
AjaxResult
turn
(
Long
shopId
,
String
goodsId
,
String
pointer
,
String
type
)
{
return
AjaxResult
.
success
(
shopRecommendService
.
turn
(
shopId
,
goodsId
,
pointer
,
type
));
public
AjaxResult
turn
(
Long
shopId
,
String
goodsId
,
String
pointer
,
String
type
)
{
return
AjaxResult
.
success
(
shopRecommendService
.
turn
(
shopId
,
goodsId
,
pointer
,
type
));
}
/**
* 查询推荐和今日特惠列表
*/
// @PreAuthorize("@ss.hasPermi('system:recommend:list')")
// @PreAuthorize("@ss.hasPermi('system:recommend:list')")
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
ShopRecommend
shopRecommend
)
{
public
TableDataInfo
list
(
ShopRecommend
shopRecommend
)
{
startPage
();
List
<
Goods
>
list
=
shopRecommendService
.
selectShopRecommendList
(
shopRecommend
);
goodsService
.
resolverCategoryName
(
list
);
goodsService
.
resolverGoodsVolume
(
Long
.
parseLong
(
shopRecommend
.
getShopId
()),
list
);
return
getDataTable
(
list
);
}
/**
* 获取推荐和今日特惠详细信息
*/
...
...
soss-system/src/main/java/com/soss/system/mapper/OrderDetailMapper.java
View file @
cd42f1bf
...
...
@@ -74,4 +74,9 @@ public interface OrderDetailMapper {
void
bindRefund
(
@Param
(
"refundId"
)
Long
refundId
,
@Param
(
"ids"
)
List
<
Long
>
ids
);
void
updateRefundState
(
@Param
(
"refundId"
)
Long
refundId
,
@Param
(
"refundTime"
)
Date
refundTime
);
/**
* 查询店铺商品销量
*/
List
<
OrderDetail
>
selectGoodsSalesVolume
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsIds"
)
List
<
Long
>
goodsIds
);
}
soss-system/src/main/java/com/soss/system/service/IGoodsService.java
View file @
cd42f1bf
...
...
@@ -32,6 +32,8 @@ public interface IGoodsService
*/
public
List
<
Goods
>
selectGoodsList
(
Goods
goods
);
void
resolverGoodsVolume
(
Long
shopId
,
List
<
Goods
>
goodsList
);
void
resolverCategoryName
(
List
<
Goods
>
goodsList
);
/**
...
...
soss-system/src/main/java/com/soss/system/service/impl/GoodsServiceImpl.java
View file @
cd42f1bf
...
...
@@ -48,6 +48,8 @@ public class GoodsServiceImpl implements IGoodsService
@Autowired
private
OrderMapper
orderMapper
;
@Autowired
private
OrderDetailMapper
orderDetailMapper
;
@Autowired
private
GoodsCategoryMapper
goodsCategoryMapper
;
@Autowired
private
ShopRecommendMapper
shopRecommendMapper
;
...
...
@@ -91,18 +93,39 @@ public class GoodsServiceImpl implements IGoodsService
public
List
<
Goods
>
selectGoodsList
(
Goods
goods
)
{
List
<
Goods
>
goodsList
=
goodsMapper
.
selectGoodsList
(
goods
);
this
.
resolverCategoryName
(
goodsList
);
for
(
Goods
good
:
goodsList
)
{
this
.
resolverGoodsVolume
(
null
,
goodsList
);
/*for (Goods good : goodsList) {
int count = orderMapper.selectSalesVolume(null, good.getId());
good.setSalesVolume(count);
}
}
*/
return
goodsList
;
}
@Override
public
void
resolverGoodsVolume
(
Long
shopId
,
List
<
Goods
>
goodsList
)
{
if
(
CollectionUtils
.
isEmpty
(
goodsList
))
{
return
;
}
/** 销量解析 */
List
<
Long
>
goodsIds
=
goodsList
.
stream
().
map
(
Goods:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectGoodsSalesVolume
(
shopId
,
goodsIds
);
Map
<
Long
,
String
>
goodsVolumeMap
=
orderDetails
.
stream
().
collect
(
Collectors
.
toMap
(
OrderDetail:
:
getGoodsId
,
OrderDetail:
:
getNum
));
goodsList
.
forEach
(
goods
->
{
String
volumeVal
=
goodsVolumeMap
.
get
(
goods
.
getId
());
Integer
volume
=
StringUtils
.
isNotEmpty
(
volumeVal
)
?
Integer
.
parseInt
(
volumeVal
)
:
0
;
goods
.
setSalesVolume
(
volume
);
});
}
@Override
public
void
resolverCategoryName
(
List
<
Goods
>
goodsList
)
{
if
(
CollectionUtils
.
isEmpty
(
goodsList
))
{
return
;
}
/** 品类解析 */
List
<
Long
>
categoryIds
=
new
ArrayList
<>(
16
);
goodsList
.
forEach
(
good
->
{
String
[]
categoryIdArr
=
good
.
getCategory
().
split
(
StringPool
.
COMMA
);
...
...
@@ -117,6 +140,7 @@ public class GoodsServiceImpl implements IGoodsService
});
List
<
GoodsCategory
>
categories
=
goodsCategoryMapper
.
selectGoodsCategoryByIds
(
categoryIds
);
Map
<
Long
,
String
>
categoryMap
=
categories
.
stream
().
collect
(
Collectors
.
toMap
(
GoodsCategory:
:
getId
,
GoodsCategory:
:
getName
));
goodsList
.
forEach
(
good
->
{
String
categoryName
=
Arrays
.
stream
(
good
.
getCategory
().
split
(
StringPool
.
COMMA
)).
filter
(
StringUtils:
:
isNotEmpty
)
.
map
(
Long:
:
parseLong
).
map
(
categoryMap:
:
get
)
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderTakingServiceImpl.java
View file @
cd42f1bf
...
...
@@ -14,6 +14,7 @@ import org.springframework.util.CollectionUtils;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -68,7 +69,14 @@ public class OrderTakingServiceImpl {
orderTakingVo
.
setShopState
(
shop
.
getState
());
ImagesVo
imagesVo
=
new
ImagesVo
();
orderTakingVo
.
setImages
(
imagesVo
);
imagesVo
.
setLeft
(
JSONArray
.
parseArray
(
sysConfigService
.
selectConfigByKey
(
"menu.left"
)));
String
menuLeft
=
sysConfigService
.
selectConfigByKey
(
"menu.left"
);
if
(
StringUtils
.
isNotEmpty
(
menuLeft
))
{
if
(
menuLeft
.
startsWith
(
"["
))
{
imagesVo
.
setLeft
(
JSONArray
.
parseArray
(
menuLeft
));
}
else
{
imagesVo
.
setLeft
(
JSONArray
.
parseArray
(
JSONArray
.
toJSONString
(
Collections
.
singletonList
(
menuLeft
))));
}
}
// imagesVo.setRight(JSONObject.parseObject(sysConfigService.selectConfigByKey("menu.right")));
orderTakingVo
.
setCountOfOrder
(
sysConfigService
.
selectConfigByKey
(
"goods.limit"
));
orderTakingVo
.
setTips
(
sysConfigService
.
selectConfigByKey
(
"tips.address"
));
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopRecommendServiceImpl.java
View file @
cd42f1bf
package
com
.
soss
.
system
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.Machine
;
import
com.soss.system.domain.Shop
Goods
;
import
com.soss.system.domain.Shop
Recommend
;
import
com.soss.system.jiguang.impl.JiGuangPushServiceImpl
;
import
com.soss.system.mapper.GoodsCategoryMapper
;
import
com.soss.system.mapper.MachineMapper
;
import
com.soss.system.mapper.OrderMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.soss.system.mapper.ShopRecommendMapper
;
import
com.soss.system.domain.ShopRecommend
;
import
com.soss.system.service.IShopRecommendService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 推荐和今日特惠Service业务层处理
...
...
@@ -61,10 +60,10 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
{
List
<
Goods
>
goodsList
=
shopRecommendMapper
.
selectShopRecommendGoods
(
shopRecommend
.
getShopId
(),
shopRecommend
.
getType
());
goodsList
=
goodsList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
for
(
Goods
goods
:
goodsList
)
{
/*
for (Goods goods : goodsList) {
goods.setCategoryName(goodsCategoryMapper.selectGoodsCategoryById(String.valueOf(goods.getCategory())).getName());
goods.setSalesVolume(orderMapper.selectSalesVolume(Long.parseLong(shopRecommend.getShopId()),goods.getId()));
}
}
*/
return
goodsList
;
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
View file @
cd42f1bf
...
...
@@ -167,9 +167,9 @@ public class ShopServiceImpl implements IShopService
@Override
public
int
updateShop
(
Shop
shop
)
{
shop
.
setUpdatedAt
(
new
Date
());
/*if(1 == shop.getIsDefault())
{
if
(
1
==
shop
.
getIsDefault
())
{
shopMapper
.
updateNoDefault
();
}
*/
}
if
(
shop
.
getDistanceLimit
()
==
null
)
{
shop
.
setDistanceLimit
(
0.0
);
}
...
...
soss-system/src/main/resources/mapper/system/OrderDetailMapper.xml
View file @
cd42f1bf
...
...
@@ -163,4 +163,17 @@
</choose>
where refund_id = #{refundId}
</update>
<select
id=
"selectGoodsSalesVolume"
resultMap=
"OrderDetailResult"
>
select od.goods_id, sum(od.num) num
FROM `order` o join order_detail od on o.id = od.order_id
<where>
<if
test=
"goodsIds != null and goodsIds.size() > 0"
>
and od.goods_id in
<foreach
collection=
"goodsIds"
item=
"goodsId"
open=
"("
close=
")"
separator=
","
>
#{goodsId}
</foreach>
</if>
<if
test=
"shopId != null"
>
and o.shop_id = #{shopId}
</if>
</where>
group by od.goods_id
</select>
</mapper>
\ No newline at end of file
soss-system/src/main/resources/mapper/system/OrderMapper.xml
View file @
cd42f1bf
...
...
@@ -182,7 +182,7 @@
<if
test=
"shopId !=null"
>
and o.shop_id=#{shopId}
</if>
and o.state in (
'6','7','12','13','14','15'
)) a
and o.state in (
6,7,12,13,14,15
)) a
</select>
<select
id=
"selectSalesAmount"
resultType=
"java.math.BigDecimal"
>
select
...
...
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