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
6ad67b28
Commit
6ad67b28
authored
Feb 21, 2023
by
caiyt
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/v2' into v2
parents
9c2bc2b2
7a544c1c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
1200 additions
and
327 deletions
+1200
-327
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopController.java
+19
-8
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopRecommendController.java
+6
-10
soss-admin/src/main/java/com/soss/web/controller/coffee/WeixinController.java
+2
-2
soss-admin/src/main/java/com/soss/web/controller/system/BannerController.java
+114
-0
soss-admin/src/main/test/JavaTest.java
+8
-0
soss-system/src/main/java/com/soss/system/domain/Goods.java
+18
-0
soss-system/src/main/java/com/soss/system/domain/ShopGoodsSku.java
+32
-4
soss-system/src/main/java/com/soss/system/domain/ShopRecommend.java
+37
-9
soss-system/src/main/java/com/soss/system/domain/SpecRule.java
+59
-61
soss-system/src/main/java/com/soss/system/domain/SysBanner.java
+72
-0
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/SkuVo.java
+6
-2
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/SpecRuleVo.java
+16
-6
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/SpecVo.java
+4
-4
soss-system/src/main/java/com/soss/system/mapper/ShopGoodsSkuMapper.java
+20
-13
soss-system/src/main/java/com/soss/system/mapper/SpecMapper.java
+10
-1
soss-system/src/main/java/com/soss/system/mapper/SysBannerMapper.java
+26
-0
soss-system/src/main/java/com/soss/system/service/IShopGoodsService.java
+15
-10
soss-system/src/main/java/com/soss/system/service/IShopGoodsSkuService.java
+7
-1
soss-system/src/main/java/com/soss/system/service/IShopRecommendService.java
+17
-17
soss-system/src/main/java/com/soss/system/service/ISysBannerService.java
+25
-0
soss-system/src/main/java/com/soss/system/service/impl/AppServiceImpl.java
+33
-11
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
+1
-2
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+2
-1
soss-system/src/main/java/com/soss/system/service/impl/OrderTakingServiceImpl.java
+25
-25
soss-system/src/main/java/com/soss/system/service/impl/ShopGoodsServiceImpl.java
+202
-25
soss-system/src/main/java/com/soss/system/service/impl/ShopGoodsSkuServiceImpl.java
+56
-25
soss-system/src/main/java/com/soss/system/service/impl/ShopRecommendServiceImpl.java
+63
-56
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
+26
-23
soss-system/src/main/java/com/soss/system/service/impl/SysBannerServiceImpl.java
+169
-0
soss-system/src/main/resources/mapper/system/GoodsMapper.xml
+0
-1
soss-system/src/main/resources/mapper/system/ShopGoodsMapper.xml
+2
-3
soss-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
+23
-4
soss-system/src/main/resources/mapper/system/ShopRecommendMapper.xml
+9
-3
soss-system/src/main/resources/mapper/system/SpecMapper.xml
+8
-0
soss-system/src/main/resources/mapper/system/SysBannerMapper.xml
+68
-0
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopController.java
View file @
6ad67b28
...
...
@@ -12,6 +12,7 @@ import com.soss.system.domain.GoodsCategory;
import
com.soss.system.domain.Shop
;
import
com.soss.system.service.IGoodsService
;
import
com.soss.system.service.IShopService
;
import
com.soss.system.service.impl.ShopGoodsServiceImpl
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -35,6 +36,8 @@ public class ShopController extends BaseController {
private
IShopService
shopService
;
@Autowired
private
IGoodsService
goodsService
;
@Autowired
private
ShopGoodsServiceImpl
shopGoodsService
;
@GetMapping
(
value
=
"/turn"
)
public
AjaxResult
turn
(
@RequestParam
Long
shopId
,
@RequestParam
Long
goodsId
,
@RequestParam
String
pointer
)
{
...
...
@@ -45,8 +48,7 @@ public class ShopController extends BaseController {
* 查询店铺列表
*/
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
Shop
shop
)
{
public
TableDataInfo
list
(
Shop
shop
)
{
startPage
();
List
<
Shop
>
list
=
shopService
.
selectShopList
(
shop
);
return
getDataTable
(
list
);
...
...
@@ -122,9 +124,8 @@ public class ShopController extends BaseController {
*/
@PreAuthorize
(
"@ss.hasPermi('system:shop:remove')"
)
@Log
(
title
=
"店铺"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
String
[]
ids
)
{
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
String
[]
ids
)
{
return
toAjax
(
shopService
.
deleteShopByIds
(
ids
));
}
...
...
@@ -133,10 +134,10 @@ public class ShopController extends BaseController {
*/
@PreAuthorize
(
"@ss.hasPermi('system:shop:addGoods')"
)
@GetMapping
(
value
=
"/addGoods"
)
public
AjaxResult
addGoods
(
Long
shopId
,
String
goodsIds
)
{
return
AjaxResult
.
success
(
shopService
.
addGoods
(
shopId
,
goodsIds
));
public
AjaxResult
addGoods
(
Long
shopId
,
String
goodsIds
)
{
return
AjaxResult
.
success
(
shopService
.
addGoods
(
shopId
,
goodsIds
));
}
@PostMapping
(
value
=
"/offGoods"
)
public
AjaxResult
offGoods
(
@RequestBody
String
body
)
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
body
);
...
...
@@ -209,5 +210,15 @@ public class ShopController extends BaseController {
return
getDataTable
(
list
);
}
@GetMapping
(
"/getShopGoodsSpecs"
)
public
AjaxResult
getShopGoodsSpecs
(
Long
shopId
,
Long
goodsId
)
{
return
AjaxResult
.
success
(
shopGoodsService
.
getShopGoodsSpecs
(
shopId
,
goodsId
));
}
@GetMapping
(
"/updateShopGoodsSpecState"
)
public
AjaxResult
getShopGoodsSpecs
(
Long
shopId
,
Long
goodsId
,
Long
ruleId
,
Integer
state
)
{
return
AjaxResult
.
success
(
shopGoodsService
.
updateShopGoodsSpecState
(
shopId
,
goodsId
,
ruleId
,
state
));
}
}
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopRecommendController.java
View file @
6ad67b28
...
...
@@ -52,8 +52,7 @@ public class ShopRecommendController extends BaseController {
*/
@PreAuthorize
(
"@ss.hasPermi('system:recommend:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
{
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
{
return
AjaxResult
.
success
(
shopRecommendService
.
selectShopRecommendById
(
id
));
}
...
...
@@ -63,8 +62,7 @@ public class ShopRecommendController extends BaseController {
@PreAuthorize
(
"@ss.hasPermi('system:recommend:add')"
)
@Log
(
title
=
"推荐和今日特惠"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
ShopRecommend
shopRecommend
)
{
public
AjaxResult
add
(
@RequestBody
ShopRecommend
shopRecommend
)
{
return
toAjax
(
shopRecommendService
.
insertShopRecommend
(
shopRecommend
));
}
...
...
@@ -74,8 +72,7 @@ public class ShopRecommendController extends BaseController {
@PreAuthorize
(
"@ss.hasPermi('system:recommend:edit')"
)
@Log
(
title
=
"推荐和今日特惠"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
ShopRecommend
shopRecommend
)
{
public
AjaxResult
edit
(
@RequestBody
ShopRecommend
shopRecommend
)
{
return
toAjax
(
shopRecommendService
.
updateShopRecommend
(
shopRecommend
));
}
...
...
@@ -84,10 +81,9 @@ public class ShopRecommendController extends BaseController {
*/
@PreAuthorize
(
"@ss.hasPermi('system:recommend:remove')"
)
@Log
(
title
=
"推荐和今日特惠"
,
businessType
=
BusinessType
.
DELETE
)
@GetMapping
(
"/remove"
)
public
AjaxResult
remove
(
@RequestParam
(
"goodsId"
)
String
goodsId
,
@RequestParam
(
"shopId"
)
String
shopId
,
@RequestParam
(
"type"
)
String
type
)
{
return
toAjax
(
shopRecommendService
.
deleteShopRecommend
(
goodsId
,
shopId
,
type
));
@GetMapping
(
"/remove"
)
public
AjaxResult
remove
(
@RequestParam
(
"goodsId"
)
String
goodsId
,
@RequestParam
(
"shopId"
)
String
shopId
,
@RequestParam
(
"type"
)
String
type
)
{
return
toAjax
(
shopRecommendService
.
deleteShopRecommend
(
goodsId
,
shopId
,
type
));
}
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/WeixinController.java
View file @
6ad67b28
...
...
@@ -107,8 +107,8 @@ public class WeixinController {
public
AjaxResult
getShop
(
HttpServletRequest
request
,
@RequestParam
(
required
=
false
)
String
lng
,
@RequestParam
(
required
=
false
)
String
lat
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
Shop
shop
;
if
(
loginUser
==
null
||
StringUtils
.
isEmpty
(
loginUser
.
getOpenId
()
))
{
shop
=
appService
.
getShop
(
l
ng
,
lat
,
false
);
if
(
StringUtils
.
isEmpty
(
lng
)
||
StringUtils
.
isEmpty
(
lat
))
{
shop
=
appService
.
getShop
(
l
oginUser
);
}
else
{
Customer
customer
=
customerService
.
selectCustById
(
loginUser
.
getOpenId
());
shop
=
appService
.
getShop
(
lng
,
lat
,
customer
.
getTestFlag
());
...
...
soss-admin/src/main/java/com/soss/web/controller/system/BannerController.java
0 → 100644
View file @
6ad67b28
package
com
.
soss
.
web
.
controller
.
system
;
import
com.alibaba.fastjson.JSONObject
;
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.exception.ServiceException
;
import
com.soss.system.domain.SysBanner
;
import
com.soss.system.service.ISysBannerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 轮播图Controller
*
* @author zxq
* @date 2022-04-28
*/
@RestController
@RequestMapping
(
"/system/banner"
)
public
class
BannerController
extends
BaseController
{
@Autowired
private
ISysBannerService
bannerService
;
@PostMapping
(
"/list"
)
public
TableDataInfo
list
(
@RequestBody
SysBanner
banner
)
{
startPage
();
List
<
SysBanner
>
list
=
bannerService
.
selectBanner
(
banner
);
return
getDataTable
(
list
);
}
/**
* 创建轮播图
*
* @param banner
* @return
*/
@PostMapping
(
"/create"
)
public
AjaxResult
create
(
@RequestBody
SysBanner
banner
)
{
try
{
return
AjaxResult
.
success
(
bannerService
.
createBanner
(
banner
));
}
catch
(
ServiceException
serviceException
)
{
return
AjaxResult
.
error
(
99
,
serviceException
.
getMessage
());
}
}
/**
* 修改轮播图
*
* @param banner
* @return
*/
@PostMapping
(
"/update"
)
public
AjaxResult
update
(
@RequestBody
SysBanner
banner
)
{
try
{
return
AjaxResult
.
success
(
bannerService
.
updateBanner
(
banner
));
}
catch
(
ServiceException
serviceException
)
{
return
AjaxResult
.
error
(
99
,
serviceException
.
getMessage
());
}
}
/**
* 修改轮播图状态
*
* @param bannerId
* @param state
* @return
*/
@GetMapping
(
"/state/update"
)
public
AjaxResult
update
(
@RequestParam
(
"bannerId"
)
Long
bannerId
,
@RequestParam
(
"state"
)
Integer
state
)
{
try
{
return
AjaxResult
.
success
(
bannerService
.
updateState
(
bannerId
,
state
));
}
catch
(
ServiceException
serviceException
)
{
return
AjaxResult
.
error
(
99
,
serviceException
.
getMessage
());
}
}
/**
* 删除轮播图
*
* @param bannerId
* @return
*/
@GetMapping
(
"/delete"
)
public
AjaxResult
update
(
@RequestParam
(
"bannerId"
)
Long
bannerId
)
{
try
{
return
AjaxResult
.
success
(
bannerService
.
delete
(
bannerId
));
}
catch
(
ServiceException
serviceException
)
{
return
AjaxResult
.
error
(
99
,
serviceException
.
getMessage
());
}
}
/**
* App获取轮播图
*
* @param shopId
* @return
*/
@GetMapping
(
"/getShopBanners"
)
public
AjaxResult
getShopBanners
(
@RequestParam
(
"shopId"
)
Long
shopId
)
{
try
{
List
<
SysBanner
>
homeBanners
=
bannerService
.
getBannersByShopId
(
shopId
,
1
,
1
);
List
<
SysBanner
>
mineBanners
=
bannerService
.
getBannersByShopId
(
shopId
,
1
,
2
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"home"
,
homeBanners
);
jsonObject
.
put
(
"mine"
,
mineBanners
);
return
AjaxResult
.
success
(
jsonObject
);
}
catch
(
ServiceException
serviceException
)
{
return
AjaxResult
.
error
(
99
,
serviceException
.
getMessage
());
}
}
}
soss-admin/src/main/test/JavaTest.java
0 → 100644
View file @
6ad67b28
import
java.util.Calendar
;
public
class
JavaTest
{
public
static
void
main
(
String
[]
args
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
System
.
out
.
println
(
calendar
.
get
(
Calendar
.
DAY_OF_WEEK
)
-
1
);
}
}
soss-system/src/main/java/com/soss/system/domain/Goods.java
View file @
6ad67b28
...
...
@@ -57,6 +57,18 @@ public class Goods extends BaseEntity {
private
BigDecimal
discount
;
/**
* 特惠折扣价
*/
@Excel
(
name
=
"特惠折扣价"
)
private
BigDecimal
recommendPrice
;
/**
* 特惠标签
*/
@Excel
(
name
=
"特惠标签"
)
private
BigDecimal
recommendTag
;
/**
* 制作用时 单位 秒
*/
@Excel
(
name
=
"制作用时 单位 秒"
)
...
...
@@ -118,6 +130,12 @@ public class Goods extends BaseEntity {
private
String
preferential
;
/** 商品sku数量 */
private
Integer
skuCount
;
/** 商品售罄sku数量 */
private
Integer
selloutCount
;
/**
* 总销量
*/
...
...
soss-system/src/main/java/com/soss/system/domain/ShopGoodsSku.java
View file @
6ad67b28
package
com
.
soss
.
system
.
domain
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.soss.common.annotation.Excel
;
import
com.soss.common.core.domain.BaseEntity
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 从店铺到sku关联对象 shop_goods_sku
...
...
@@ -54,7 +56,33 @@ public class ShopGoodsSku extends BaseEntity
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
public
void
setId
(
String
id
)
/**
* sku原始折扣价
*/
private
BigDecimal
origDiscount
;
/**
* 本店铺价格(根据特惠价格计算,如果不是特惠商品原折扣价)
*/
private
BigDecimal
discount
;
public
BigDecimal
getOrigDiscount
()
{
return
origDiscount
;
}
public
void
setOrigDiscount
(
BigDecimal
origDiscount
)
{
this
.
origDiscount
=
origDiscount
;
}
public
BigDecimal
getDiscount
()
{
return
discount
;
}
public
void
setDiscount
(
BigDecimal
discount
)
{
this
.
discount
=
discount
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
...
...
soss-system/src/main/java/com/soss/system/domain/ShopRecommend.java
View file @
6ad67b28
package
com
.
soss
.
system
.
domain
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.soss.common.annotation.Excel
;
import
com.soss.common.core.domain.BaseEntity
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 推荐和今日特惠对象 shop_recommend
...
...
@@ -44,13 +46,15 @@ public class ShopRecommend extends BaseEntity
@Excel
(
name
=
"推荐排序"
)
private
String
turn
;
public
String
getName
()
{
return
name
;
}
/**
* 特惠价格
*/
private
BigDecimal
recommendPrice
;
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
/**
* 特惠标签
*/
private
String
recommendTag
;
/** 描述 */
@Excel
(
name
=
"描述"
)
...
...
@@ -199,6 +203,30 @@ public class ShopRecommend extends BaseEntity
return
updatedAt
;
}
public
BigDecimal
getRecommendPrice
()
{
return
recommendPrice
;
}
public
void
setRecommendPrice
(
BigDecimal
recommendPrice
)
{
this
.
recommendPrice
=
recommendPrice
;
}
public
String
getRecommendTag
()
{
return
recommendTag
;
}
public
void
setRecommendTag
(
String
recommendTag
)
{
this
.
recommendTag
=
recommendTag
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
soss-system/src/main/java/com/soss/system/domain/SpecRule.java
View file @
6ad67b28
package
com
.
soss
.
system
.
domain
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.soss.common.annotation.Excel
;
import
com.soss.common.core.domain.BaseEntity
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
* 规格选项对象 spec_rule
*
*
* @author zxq
* @date 2022-04-28
*/
public
class
SpecRule
extends
BaseEntity
{
public
class
SpecRule
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
...
...
@@ -61,6 +60,16 @@ public class SpecRule extends BaseEntity
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
private
Integer
state
;
public
Integer
getState
()
{
return
state
;
}
public
void
setState
(
Integer
state
)
{
this
.
state
=
state
;
}
private
List
<
SpecRuleMaterial
>
specRuleMaterials
;
public
List
<
SpecRuleMaterial
>
getSpecRuleMaterials
()
{
...
...
@@ -71,110 +80,99 @@ public class SpecRule extends BaseEntity
this
.
specRuleMaterials
=
specRuleMaterials
;
}
public
void
setId
(
long
id
)
{
public
void
setId
(
long
id
)
{
this
.
id
=
id
;
}
public
long
getId
()
{
public
long
getId
()
{
return
id
;
}
public
void
setName
(
String
name
)
{
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
public
String
getName
()
{
return
name
;
}
public
void
setSpecId
(
long
specId
)
{
public
void
setSpecId
(
long
specId
)
{
this
.
specId
=
specId
;
}
public
long
getSpecId
()
{
public
long
getSpecId
()
{
return
specId
;
}
public
void
setAmount
(
BigDecimal
amount
)
{
public
void
setAmount
(
BigDecimal
amount
)
{
this
.
amount
=
amount
;
}
public
BigDecimal
getAmount
()
{
public
BigDecimal
getAmount
()
{
return
amount
;
}
public
void
setTurn
(
String
turn
)
{
public
void
setTurn
(
String
turn
)
{
this
.
turn
=
turn
;
}
public
String
getTurn
()
{
public
String
getTurn
()
{
return
turn
;
}
public
void
setIsRecommend
(
String
isRecommend
)
{
public
void
setIsRecommend
(
String
isRecommend
)
{
this
.
isRecommend
=
isRecommend
;
}
public
String
getIsRecommend
()
{
public
String
getIsRecommend
()
{
return
isRecommend
;
}
public
void
setIsDefault
(
Long
isDefault
)
{
public
void
setIsDefault
(
Long
isDefault
)
{
this
.
isDefault
=
isDefault
;
}
public
Long
getIsDefault
()
{
public
Long
getIsDefault
()
{
return
isDefault
;
}
public
void
setIsDeleted
(
int
isDeleted
)
{
public
void
setIsDeleted
(
int
isDeleted
)
{
this
.
isDeleted
=
isDeleted
;
}
public
int
getIsDeleted
()
{
public
int
getIsDeleted
()
{
return
isDeleted
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
Date
getCreatedAt
()
{
public
Date
getCreatedAt
()
{
return
createdAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
public
Date
getUpdatedAt
()
{
public
Date
getUpdatedAt
()
{
return
updatedAt
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"name"
,
getName
())
.
append
(
"specId"
,
getSpecId
())
.
append
(
"amount"
,
getAmount
())
.
append
(
"turn"
,
getTurn
())
.
append
(
"isRecommend"
,
getIsRecommend
())
.
append
(
"isDefault"
,
getIsDefault
())
.
append
(
"isDeleted"
,
getIsDeleted
())
.
append
(
"createdAt"
,
getCreatedAt
())
.
append
(
"updatedAt"
,
getUpdatedAt
())
.
toString
();
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"name"
,
getName
())
.
append
(
"specId"
,
getSpecId
())
.
append
(
"amount"
,
getAmount
())
.
append
(
"turn"
,
getTurn
())
.
append
(
"isRecommend"
,
getIsRecommend
())
.
append
(
"isDefault"
,
getIsDefault
())
.
append
(
"isDeleted"
,
getIsDeleted
())
.
append
(
"createdAt"
,
getCreatedAt
())
.
append
(
"updatedAt"
,
getUpdatedAt
())
.
toString
();
}
}
soss-system/src/main/java/com/soss/system/domain/SysBanner.java
0 → 100644
View file @
6ad67b28
package
com
.
soss
.
system
.
domain
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.soss.common.core.domain.BaseEntity
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 轮播图对象 banner
*
* @author zxq
* @date 2022-04-28
*/
@Data
public
class
SysBanner
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
private
Long
id
;
/**
* 图片url
*/
private
String
image
;
/**
* 页面url
*/
private
String
page
;
/**
* 类型:1-小程序,2-KDS,3-点单屏
*/
private
Integer
type
;
/**
* 目标:1-小程序首页,2-小程序我的
*/
private
Integer
target
;
/**
* 省份列表
*/
private
String
province
;
/**
* 城市列表
*/
private
String
city
;
/**
* 区域列表
*/
private
String
area
;
/**
* 店铺id列表
*/
private
String
shopIds
;
/**
* 排序
*/
private
Integer
sort
;
/**
* 状态:0-在线,1-下线
*/
private
Integer
state
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createdAt
;
/**
* 更新时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updatedAt
;
}
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/SkuVo.java
View file @
6ad67b28
...
...
@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONArray;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
@Data
public
class
SkuVo
implements
Serializable
{
private
Long
id
;
private
Long
skuId
;
private
String
state
;
...
...
@@ -22,7 +25,8 @@ public class SkuVo implements Serializable {
private
String
rulesString
;
private
String
discount
;
private
Integer
isDelete
;
private
BigDecimal
discount
;
private
BigDecimal
origDiscount
;
}
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/SpecRuleVo.java
View file @
6ad67b28
...
...
@@ -7,6 +7,22 @@ public class SpecRuleVo implements Serializable {
private
String
ruleName
;
private
String
price
;
private
String
isDefault
;
private
String
isRecommend
;
private
Integer
state
;
public
Integer
getState
()
{
return
state
;
}
public
void
setState
(
Integer
state
)
{
this
.
state
=
state
;
}
public
String
getRuleId
()
{
return
ruleId
;
}
...
...
@@ -31,8 +47,6 @@ public class SpecRuleVo implements Serializable {
this
.
price
=
price
;
}
private
String
price
;
public
String
getIsDefault
()
{
return
isDefault
;
}
...
...
@@ -48,8 +62,4 @@ public class SpecRuleVo implements Serializable {
public
void
setIsRecommend
(
String
isRecommend
)
{
this
.
isRecommend
=
isRecommend
;
}
private
String
isDefault
;
private
String
isRecommend
;
}
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/SpecVo.java
View file @
6ad67b28
...
...
@@ -6,6 +6,10 @@ import java.util.List;
public
class
SpecVo
implements
Serializable
{
private
String
specId
;
private
String
specName
;
private
List
<
SpecRuleVo
>
rules
;
public
String
getSpecId
()
{
return
specId
;
}
...
...
@@ -29,8 +33,4 @@ public class SpecVo implements Serializable {
public
void
setRules
(
List
<
SpecRuleVo
>
rules
)
{
this
.
rules
=
rules
;
}
private
String
specName
;
private
List
<
SpecRuleVo
>
rules
;
}
soss-system/src/main/java/com/soss/system/mapper/ShopGoodsSkuMapper.java
View file @
6ad67b28
package
com
.
soss
.
system
.
mapper
;
import
java.util.List
;
import
com.soss.system.domain.GoodsSku
;
import
com.soss.system.domain.ShopGoodsSku
;
import
com.soss.system.domain.vo.orderTaking.SkuVo
;
import
org.apache.ibatis.annotations.Param
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* 从店铺到sku关联Mapper接口
*
*
* @author zxq
* @date 2022-04-28
*/
public
interface
ShopGoodsSkuMapper
{
public
interface
ShopGoodsSkuMapper
{
/**
* 查询从店铺到sku关联
*
*
* @param id 从店铺到sku关联主键
* @return 从店铺到sku关联
*/
...
...
@@ -25,15 +25,18 @@ public interface ShopGoodsSkuMapper
/**
* 查询从店铺到sku关联列表
*
*
* @param shopGoodsSku 从店铺到sku关联
* @return 从店铺到sku关联集合
*/
public
List
<
ShopGoodsSku
>
selectShopGoodsSkuList
(
ShopGoodsSku
shopGoodsSku
);
Integer
getSellinSkuCount
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
Long
goodsId
);
Integer
getSelloutSkuCount
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
Long
goodsId
);
/**
* 新增从店铺到sku关联
*
*
* @param shopGoodsSku 从店铺到sku关联
* @return 结果
*/
...
...
@@ -41,7 +44,7 @@ public interface ShopGoodsSkuMapper
/**
* 修改从店铺到sku关联
*
*
* @param shopGoodsSku 从店铺到sku关联
* @return 结果
*/
...
...
@@ -49,7 +52,7 @@ public interface ShopGoodsSkuMapper
/**
* 删除从店铺到sku关联
*
*
* @param id 从店铺到sku关联主键
* @return 结果
*/
...
...
@@ -57,7 +60,7 @@ public interface ShopGoodsSkuMapper
/**
* 批量删除从店铺到sku关联
*
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
...
...
@@ -65,11 +68,15 @@ public interface ShopGoodsSkuMapper
List
<
GoodsSku
>
selectSkuByShopAndGoods
(
@Param
(
"shopId"
)
long
shopId
,
@Param
(
"goodsId"
)
long
goodsId
);
List
<
SkuVo
>
selectSkuByGoodAndShop
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
String
goodId
);
List
<
SkuVo
>
selectSkuByGoodAndShop
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
String
goodId
);
void
deleteShopGoodsSkuByGoodsId
(
@Param
(
"goodsId"
)
Long
goodsId
);
int
updateSkuStatus
(
@Param
(
"skuIds"
)
List
<
String
>
skuIds
,
@Param
(
"machineCode"
)
String
robotID
,
@Param
(
"shopId"
)
String
shopID
,
@Param
(
"status"
)
String
status
);
int
updateSkuStatus
(
@Param
(
"skuIds"
)
List
<
String
>
skuIds
,
@Param
(
"machineCode"
)
String
robotID
,
@Param
(
"shopId"
)
String
shopID
,
@Param
(
"status"
)
String
status
);
void
deleteByGoodsIds
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsIds"
)
List
<
String
>
goodsIds
);
void
updateSkuDiscount
(
@Param
(
"id"
)
Long
id
,
@Param
(
"discount"
)
BigDecimal
discount
);
void
restoreSkuDiscount
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsId"
)
Long
goodsId
);
}
soss-system/src/main/java/com/soss/system/mapper/SpecMapper.java
View file @
6ad67b28
package
com
.
soss
.
system
.
mapper
;
import
java.util.List
;
import
com.soss.system.domain.Spec
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 规格Mapper接口
...
...
@@ -18,6 +20,13 @@ public interface SpecMapper
* @return 规格
*/
public
Spec
selectSpecById
(
String
id
);
/**
* 查询规格
*
* @param ids 规格主键
* @return 规格
*/
public
List
<
Spec
>
selectSpecByIds
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
/**
* 查询规格列表
...
...
soss-system/src/main/java/com/soss/system/mapper/SysBannerMapper.java
0 → 100644
View file @
6ad67b28
package
com
.
soss
.
system
.
mapper
;
import
com.soss.system.domain.SysBanner
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 轮播图Mapper接口
*
* @author zxq
* @date 2022-04-28
*/
public
interface
SysBannerMapper
{
List
<
SysBanner
>
selectBanner
(
SysBanner
banner
);
Long
createBanner
(
SysBanner
banner
);
Integer
updateBanner
(
SysBanner
banner
);
Integer
updateState
(
SysBanner
banner
);
Integer
delete
(
Long
bannerId
);
List
<
SysBanner
>
selectBanners
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"target"
)
Integer
target
);
}
soss-system/src/main/java/com/soss/system/service/IShopGoodsService.java
View file @
6ad67b28
package
com
.
soss
.
system
.
service
;
import
java.util.List
;
import
com.soss.system.domain.ShopGoods
;
import
com.soss.system.domain.Spec
;
import
java.util.List
;
/**
* 店铺和商品关联Service接口
*
*
* @author zxq
* @date 2022-04-28
*/
public
interface
IShopGoodsService
{
public
interface
IShopGoodsService
{
/**
* 查询店铺和商品关联
*
*
* @param id 店铺和商品关联主键
* @return 店铺和商品关联
*/
...
...
@@ -21,7 +22,7 @@ public interface IShopGoodsService
/**
* 查询店铺和商品关联列表
*
*
* @param shopGoods 店铺和商品关联
* @return 店铺和商品关联集合
*/
...
...
@@ -29,7 +30,7 @@ public interface IShopGoodsService
/**
* 新增店铺和商品关联
*
*
* @param shopGoods 店铺和商品关联
* @return 结果
*/
...
...
@@ -37,7 +38,7 @@ public interface IShopGoodsService
/**
* 修改店铺和商品关联
*
*
* @param shopGoods 店铺和商品关联
* @return 结果
*/
...
...
@@ -45,7 +46,7 @@ public interface IShopGoodsService
/**
* 批量删除店铺和商品关联
*
*
* @param ids 需要删除的店铺和商品关联主键集合
* @return 结果
*/
...
...
@@ -53,9 +54,13 @@ public interface IShopGoodsService
/**
* 删除店铺和商品关联信息
*
*
* @param id 店铺和商品关联主键
* @return 结果
*/
public
int
deleteShopGoodsById
(
String
id
);
List
<
Spec
>
getShopGoodsSpecs
(
Long
shopId
,
Long
goodsId
);
Boolean
updateShopGoodsSpecState
(
Long
shopId
,
Long
goodsId
,
Long
ruleId
,
Integer
state
);
}
soss-system/src/main/java/com/soss/system/service/IShopGoodsSkuService.java
View file @
6ad67b28
package
com
.
soss
.
system
.
service
;
import
java.util.List
;
import
com.soss.system.domain.ShopGoodsSku
;
import
org.apache.ibatis.annotations.Param
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* 从店铺到sku关联Service接口
...
...
@@ -58,4 +61,7 @@ public interface IShopGoodsSkuService
* @return 结果
*/
public
int
deleteShopGoodsSkuById
(
String
id
);
void
updateShopGoodsSkuDiscount
(
String
shopId
,
String
goodsId
,
BigDecimal
discount
);
void
restoreSkuDiscount
(
Long
shopId
,
Long
goodsId
);
}
soss-system/src/main/java/com/soss/system/service/IShopRecommendService.java
View file @
6ad67b28
package
com
.
soss
.
system
.
service
;
import
java.util.List
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.ShopRecommend
;
import
java.util.List
;
/**
* 推荐和今日特惠Service接口
*
...
...
@@ -45,21 +45,21 @@ public interface IShopRecommendService
*/
public
int
updateShopRecommend
(
ShopRecommend
shopRecommend
);
/**
* 批量删除推荐和今日特惠
*
* @param ids 需要删除的推荐和今日特惠主键集合
* @return 结果
*/
public
int
deleteShopRecommendByIds
(
String
[]
ids
);
/**
* 删除推荐和今日特惠信息
*
* @param id 推荐和今日特惠主键
* @return 结果
*/
public
int
deleteShopRecommendById
(
String
id
);
//
/**
//
* 批量删除推荐和今日特惠
// *
//
* @param ids 需要删除的推荐和今日特惠主键集合
//
* @return 结果
//
*/
//
public int deleteShopRecommendByIds(String[] ids);
//
//
/**
//
* 删除推荐和今日特惠信息
// *
//
* @param id 推荐和今日特惠主键
//
* @return 结果
//
*/
//
public int deleteShopRecommendById(String id);
String
turn
(
Long
shopId
,
String
fistId
,
String
lastId
,
String
type
);
...
...
soss-system/src/main/java/com/soss/system/service/ISysBannerService.java
0 → 100644
View file @
6ad67b28
package
com
.
soss
.
system
.
service
;
import
com.soss.system.domain.SysBanner
;
import
java.util.List
;
/**
* 轮播图Service接口
*
* @author zxq
* @date 2022-04-28
*/
public
interface
ISysBannerService
{
List
<
SysBanner
>
selectBanner
(
SysBanner
banner
);
Long
createBanner
(
SysBanner
banner
);
Boolean
updateBanner
(
SysBanner
banner
);
Boolean
updateState
(
Long
bannerId
,
Integer
state
);
Boolean
delete
(
Long
bannerId
);
List
<
SysBanner
>
getBannersByShopId
(
Long
shopId
,
Integer
type
,
Integer
target
);
}
soss-system/src/main/java/com/soss/system/service/impl/AppServiceImpl.java
View file @
6ad67b28
package
com
.
soss
.
system
.
service
.
impl
;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.common.enums.ShopState
;
import
com.soss.
common.utils.StringUtils
;
import
com.soss.
system.domain.Order
;
import
com.soss.system.domain.Shop
;
import
com.soss.system.mapper.ShopMapper
;
import
com.soss.system.utils.DistanceUtil
;
...
...
@@ -18,6 +19,35 @@ import java.util.List;
public
class
AppServiceImpl
{
@Autowired
private
ShopMapper
shopMapper
;
@Autowired
private
ShopServiceImpl
shopService
;
@Autowired
private
OrderServiceImpl
orderService
;
public
Shop
getShop
(
LoginUser
loginUser
)
{
if
(
loginUser
==
null
)
{
// 未登录,返回默认店铺
return
getDefaultShop
();
}
else
{
// 已登录
List
<
Order
>
myOrder
=
orderService
.
getMyOrder
(
loginUser
.
getOpenId
());
if
(
CollectionUtils
.
isEmpty
(
myOrder
))
{
// 未下过单返回默认店铺
return
getDefaultShop
();
}
// 返回最后下单店铺
Order
order
=
myOrder
.
get
(
0
);
Shop
shop
=
shopService
.
selectShopById
(
order
.
getShopId
());
return
shop
==
null
?
new
Shop
()
:
shop
;
}
}
public
Shop
getDefaultShop
()
{
Shop
shop
=
new
Shop
();
shop
.
setIsDefault
(
1L
);
List
<
Shop
>
shops
=
shopMapper
.
selectShopList
(
shop
);
return
CollectionUtils
.
isEmpty
(
shops
)
?
new
Shop
()
:
shops
.
get
(
0
);
}
/**
* 授权了地理位置的用户都展示距离最近的营业中的店铺;
...
...
@@ -25,12 +55,9 @@ public class AppServiceImpl {
*/
public
Shop
getShop
(
String
lng
,
String
lat
,
Boolean
testFlag
)
{
Shop
shop
=
new
Shop
();
boolean
unAuthed
=
StringUtils
.
isEmpty
(
lng
)
||
StringUtils
.
isEmpty
(
lat
);
Comparator
<
Shop
>
shopComparator
=
Comparator
.
comparing
(
Shop:
:
getRealDistance
);
if
(
unAuthed
)
{
shop
.
setIsDefault
(
1L
);
}
else
if
(
BooleanUtils
.
isTrue
(
testFlag
))
{
if
(
BooleanUtils
.
isTrue
(
testFlag
))
{
shop
.
setStates
(
Arrays
.
asList
(
ShopState
.
TESTING
.
getState
(),
ShopState
.
OPEN
.
getState
()));
}
else
{
shop
.
setStates
(
Arrays
.
asList
(
ShopState
.
OPEN
.
getState
(),
ShopState
.
CLOSE
.
getState
()));
...
...
@@ -42,13 +69,8 @@ public class AppServiceImpl {
return
new
Shop
();
}
if
(
unAuthed
)
{
return
shops
.
get
(
0
);
}
shops
.
forEach
(
sp
->
{
double
realDistance
=
DistanceUtil
.
getRealDistance
(
Double
.
parseDouble
(
lng
),
Double
.
parseDouble
(
lat
),
Double
.
parseDouble
(
sp
.
getLng
()),
Double
.
parseDouble
(
sp
.
getLat
()));
double
realDistance
=
DistanceUtil
.
getRealDistance
(
Double
.
parseDouble
(
lng
),
Double
.
parseDouble
(
lat
),
Double
.
parseDouble
(
sp
.
getLng
()),
Double
.
parseDouble
(
sp
.
getLat
()));
sp
.
setRealDistance
(
realDistance
);
String
distanceDesc
=
DistanceUtil
.
getDistanceDesc
(
realDistance
);
sp
.
setDistance
(
distanceDesc
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
View file @
6ad67b28
...
...
@@ -108,8 +108,7 @@ public class MachineApiServiceImpl {
* @param map
*/
private
void
push
(
Machine
machine
,
String
status
,
Map
<
Long
,
List
<
Long
>>
map
)
{
public
void
push
(
Machine
machine
,
String
status
,
Map
<
Long
,
List
<
Long
>>
map
)
{
for
(
Long
aLong
:
map
.
keySet
())
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"action"
,
"SKU_STATE_CHANGED"
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
6ad67b28
...
...
@@ -513,7 +513,8 @@ public class OrderServiceImpl implements IOrderService {
*/
private
String
getOrderNum
(
Long
shopId
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
String
key
=
calendar
.
getTime
().
toString
().
substring
(
0
,
3
);
// String key = calendar.getTime().toString().substring(0, 3);
String
key
=
String
.
valueOf
(
calendar
.
get
(
Calendar
.
DAY_OF_WEEK
)
-
1
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
format
=
simpleDateFormat
.
format
(
calendar
.
getTime
());
String
redisKey
=
"shopId"
+
format
+
shopId
;
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderTakingServiceImpl.java
View file @
6ad67b28
...
...
@@ -78,31 +78,31 @@ public class OrderTakingServiceImpl {
orderTakingVo
.
setCountOfOrder
(
sysConfigService
.
selectConfigByKey
(
"goods.limit"
));
orderTakingVo
.
setTips
(
sysConfigService
.
selectConfigByKey
(
"tips.address"
));
List
<
CategoryVo
>
categoryVos
=
new
ArrayList
<>();
CategoryVo
preferentialCategoryVo
=
new
CategoryVo
();
categoryVos
.
add
(
preferentialCategoryVo
);
preferentialCategoryVo
.
setId
(
0L
);
preferentialCategoryVo
.
setName
(
"今日特惠"
);
//查询出该店铺今日特惠的商品
List
<
GoodsVo
>
goodsVos
=
shopRecommendMapper
.
selectShopGoodsByTyepe
(
"2"
,
shopId
);
preferentialCategoryVo
.
setGoods
(
goodsVos
);
if
(!
CollectionUtils
.
isEmpty
(
goodsVos
)){
for
(
GoodsVo
goodsVo
:
goodsVos
)
{
GoodsTag
goodsTag
=
new
GoodsTag
();
goodsTag
.
setState
(
"1"
);
goodsVo
.
setSpecs
(
buildGoodsSpec
(
goodsVo
.
getSpecString
()));
goodsVo
.
setSpecString
(
null
);
goodsTag
.
setGoodsId
(
Long
.
parseLong
(
goodsVo
.
getGoodsId
()));
goodsVo
.
setPics
(
JSONObject
.
parseObject
(
goodsVo
.
getPictures
()));
goodsVo
.
setPictures
(
null
);
List
<
GoodsTag
>
goodsTags
=
goodsTagMapper
.
selectGoodsTagList
(
goodsTag
);
List
<
String
>
tags
=
goodsTags
.
stream
().
map
(
GoodsTag:
:
getTag
).
collect
(
Collectors
.
toList
());
goodsVo
.
setTags
(
tags
);
//获取产品信息
List
<
SkuVo
>
skuVos
=
shopGoodsSkuMapper
.
selectSkuByGoodAndShop
(
shopId
,
goodsVo
.
getGoodsId
());
buildSkuRules
(
skuVos
);
goodsVo
.
setSkus
(
skuVos
);
}
}
//
CategoryVo preferentialCategoryVo = new CategoryVo();
//
categoryVos.add(preferentialCategoryVo);
//
preferentialCategoryVo.setId(0L);
//
preferentialCategoryVo.setName("今日特惠");
//
//查询出该店铺今日特惠的商品
//
List<GoodsVo> goodsVos = shopRecommendMapper.selectShopGoodsByTyepe("2", shopId);
//
preferentialCategoryVo.setGoods(goodsVos);
//
if(!CollectionUtils.isEmpty(goodsVos)){
//
for (GoodsVo goodsVo : goodsVos) {
//
GoodsTag goodsTag = new GoodsTag();
//
goodsTag.setState("1");
//
goodsVo.setSpecs(buildGoodsSpec(goodsVo.getSpecString()));
//
goodsVo.setSpecString(null);
//
goodsTag.setGoodsId(Long.parseLong(goodsVo.getGoodsId()));
//
goodsVo.setPics(JSONObject.parseObject(goodsVo.getPictures()));
//
goodsVo.setPictures(null);
//
List<GoodsTag> goodsTags = goodsTagMapper.selectGoodsTagList(goodsTag);
//
List<String> tags = goodsTags.stream().map(GoodsTag::getTag).collect(Collectors.toList());
//
goodsVo.setTags(tags);
//
//获取产品信息
//
List<SkuVo> skuVos = shopGoodsSkuMapper.selectSkuByGoodAndShop(shopId, goodsVo.getGoodsId());
//
buildSkuRules(skuVos);
//
goodsVo.setSkus(skuVos);
//
}
//
}
//推荐
List
<
String
>
recommendGoodsId
=
new
ArrayList
<>();
List
<
RecommendVo
>
recommendVos
=
new
ArrayList
<>();
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopGoodsServiceImpl.java
View file @
6ad67b28
This diff is collapsed.
Click to expand it.
soss-system/src/main/java/com/soss/system/service/impl/ShopGoodsSkuServiceImpl.java
View file @
6ad67b28
package
com
.
soss
.
system
.
service
.
impl
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.soss.system.mapper.ShopGoodsSkuMapper
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.ShopGoodsSku
;
import
com.soss.system.domain.vo.orderTaking.SkuVo
;
import
com.soss.system.mapper.GoodsMapper
;
import
com.soss.system.mapper.ShopGoodsSkuMapper
;
import
com.soss.system.service.IShopGoodsSkuService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
* 从店铺到sku关联Service业务层处理
*
*
* @author zxq
* @date 2022-04-28
*/
@Service
public
class
ShopGoodsSkuServiceImpl
implements
IShopGoodsSkuService
{
public
class
ShopGoodsSkuServiceImpl
implements
IShopGoodsSkuService
{
@Autowired
private
ShopGoodsSkuMapper
shopGoodsSkuMapper
;
@Autowired
private
GoodsMapper
goodsMapper
;
/**
* 查询从店铺到sku关联
*
*
* @param id 从店铺到sku关联主键
* @return 从店铺到sku关联
*/
@Override
public
ShopGoodsSku
selectShopGoodsSkuById
(
String
id
)
{
public
ShopGoodsSku
selectShopGoodsSkuById
(
String
id
)
{
return
shopGoodsSkuMapper
.
selectShopGoodsSkuById
(
id
);
}
/**
* 查询从店铺到sku关联列表
*
*
* @param shopGoodsSku 从店铺到sku关联
* @return 从店铺到sku关联
*/
@Override
public
List
<
ShopGoodsSku
>
selectShopGoodsSkuList
(
ShopGoodsSku
shopGoodsSku
)
{
public
List
<
ShopGoodsSku
>
selectShopGoodsSkuList
(
ShopGoodsSku
shopGoodsSku
)
{
return
shopGoodsSkuMapper
.
selectShopGoodsSkuList
(
shopGoodsSku
);
}
/**
* 新增从店铺到sku关联
*
*
* @param shopGoodsSku 从店铺到sku关联
* @return 结果
*/
@Override
public
int
insertShopGoodsSku
(
ShopGoodsSku
shopGoodsSku
)
{
public
int
insertShopGoodsSku
(
ShopGoodsSku
shopGoodsSku
)
{
return
shopGoodsSkuMapper
.
insertShopGoodsSku
(
shopGoodsSku
);
}
/**
* 修改从店铺到sku关联
*
*
* @param shopGoodsSku 从店铺到sku关联
* @return 结果
*/
@Override
public
int
updateShopGoodsSku
(
ShopGoodsSku
shopGoodsSku
)
{
public
int
updateShopGoodsSku
(
ShopGoodsSku
shopGoodsSku
)
{
return
shopGoodsSkuMapper
.
updateShopGoodsSku
(
shopGoodsSku
);
}
/**
* 批量删除从店铺到sku关联
*
*
* @param ids 需要删除的从店铺到sku关联主键
* @return 结果
*/
@Override
public
int
deleteShopGoodsSkuByIds
(
String
[]
ids
)
{
public
int
deleteShopGoodsSkuByIds
(
String
[]
ids
)
{
return
shopGoodsSkuMapper
.
deleteShopGoodsSkuByIds
(
ids
);
}
/**
* 删除从店铺到sku关联信息
*
*
* @param id 从店铺到sku关联主键
* @return 结果
*/
@Override
public
int
deleteShopGoodsSkuById
(
String
id
)
{
public
int
deleteShopGoodsSkuById
(
String
id
)
{
return
shopGoodsSkuMapper
.
deleteShopGoodsSkuById
(
id
);
}
@Override
public
void
updateShopGoodsSkuDiscount
(
String
shopId
,
String
goodsId
,
BigDecimal
discount
)
{
Goods
goods
=
goodsMapper
.
selectGoodsById
(
Long
.
parseLong
(
goodsId
));
if
(
goods
==
null
)
{
throw
new
ServiceException
(
"商品不存在"
);
}
List
<
SkuVo
>
skus
=
shopGoodsSkuMapper
.
selectSkuByGoodAndShop
(
Long
.
parseLong
(
shopId
),
goodsId
);
if
(
CollectionUtils
.
isEmpty
(
skus
))
{
throw
new
ServiceException
(
"sku不存在"
);
}
if
(
discount
.
compareTo
(
goods
.
getDiscount
())
>
0
)
{
throw
new
ServiceException
(
"特惠价格不能大于原折扣价"
);
}
BigDecimal
subtract
=
goods
.
getDiscount
().
subtract
(
discount
);
// 商品原折扣价和特惠价格差额
if
(
subtract
.
floatValue
()
==
0
)
{
// 金额没变化
return
;
}
skus
.
forEach
(
sku
->
{
// 重新计算店铺商品sku特惠价格
BigDecimal
newDiscount
=
sku
.
getOrigDiscount
().
subtract
(
subtract
);
shopGoodsSkuMapper
.
updateSkuDiscount
(
sku
.
getId
(),
newDiscount
);
});
}
@Override
public
void
restoreSkuDiscount
(
Long
shopId
,
Long
goodsId
)
{
shopGoodsSkuMapper
.
restoreSkuDiscount
(
shopId
,
goodsId
);
}
}
soss-system/src/main/java/com/soss/system/service/impl/ShopRecommendServiceImpl.java
View file @
6ad67b28
package
com
.
soss
.
system
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.Machine
;
import
com.soss.system.domain.ShopRecommend
;
...
...
@@ -19,16 +21,17 @@ import java.util.stream.Collectors;
/**
* 推荐和今日特惠Service业务层处理
*
*
* @author zxq
* @date 2022-04-28
*/
@Service
public
class
ShopRecommendServiceImpl
implements
IShopRecommendService
{
public
class
ShopRecommendServiceImpl
implements
IShopRecommendService
{
@Autowired
private
ShopRecommendMapper
shopRecommendMapper
;
@Autowired
private
ShopGoodsSkuServiceImpl
shopGoodsSkuService
;
@Autowired
private
MachineMapper
machineMapper
;
@Autowired
private
OrderMapper
orderMapper
;
...
...
@@ -39,43 +42,47 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
/**
* 查询推荐和今日特惠
*
*
* @param id 推荐和今日特惠主键
* @return 推荐和今日特惠
*/
@Override
public
ShopRecommend
selectShopRecommendById
(
String
id
)
{
public
ShopRecommend
selectShopRecommendById
(
String
id
)
{
return
shopRecommendMapper
.
selectShopRecommendById
(
id
);
}
/**
* 查询推荐和今日特惠列表
*
*
* @param shopRecommend 推荐和今日特惠
* @return 推荐和今日特惠
*/
@Override
public
List
<
Goods
>
selectShopRecommendList
(
ShopRecommend
shopRecommend
)
{
List
<
Goods
>
goodsList
=
shopRecommendMapper
.
selectShopRecommendGoods
(
shopRecommend
.
getShopId
(),
shopRecommend
.
getType
());
public
List
<
Goods
>
selectShopRecommendList
(
ShopRecommend
shopRecommend
)
{
List
<
Goods
>
goodsList
=
shopRecommendMapper
.
selectShopRecommendGoods
(
shopRecommend
.
getShopId
(),
shopRecommend
.
getType
());
goodsList
=
goodsList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
/*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
;
return
goodsList
;
}
/**
* 新增推荐和今日特惠
*
*
* @param shopRecommend 推荐和今日特惠
* @return 结果
*/
@Override
public
int
insertShopRecommend
(
ShopRecommend
shopRecommend
)
{
public
int
insertShopRecommend
(
ShopRecommend
shopRecommend
)
{
if
(!
StringUtils
.
isEmpty
(
shopRecommend
.
getType
())
&&
shopRecommend
.
getType
().
equals
(
"2"
))
{
// 特惠
if
(
shopRecommend
.
getRecommendPrice
()
==
null
||
shopRecommend
.
getRecommendPrice
().
floatValue
()
<
0
)
{
throw
new
ServiceException
(
"特惠价格不正确"
);
}
shopGoodsSkuService
.
updateShopGoodsSkuDiscount
(
shopRecommend
.
getShopId
(),
shopRecommend
.
getGoodsId
(),
shopRecommend
.
getRecommendPrice
());
}
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
Long
.
parseLong
(
shopRecommend
.
getShopId
()));
shopRecommend
.
setCreatedAt
(
new
Date
());
...
...
@@ -86,11 +93,11 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
return
shopRecommendMapper
.
updateShopRecommend
(
shopRecommend
);
}
public
void
updateApplication
(
long
shopId
){
public
void
updateApplication
(
long
shopId
)
{
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
shopId
);
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
if
(!
machines
.
isEmpty
())
{
if
(!
machines
.
isEmpty
())
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"action"
,
"GOODS_CHANGED"
);
jsonObject
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
...
...
@@ -101,64 +108,61 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
/**
* 修改推荐和今日特惠
*
*
* @param shopRecommend 推荐和今日特惠
* @return 结果
*/
@Override
public
int
updateShopRecommend
(
ShopRecommend
shopRecommend
)
{
public
int
updateShopRecommend
(
ShopRecommend
shopRecommend
)
{
return
shopRecommendMapper
.
updateShopRecommend
(
shopRecommend
);
}
/**
* 批量删除推荐和今日特惠
*
* @param ids 需要删除的推荐和今日特惠主键
* @return 结果
*/
@Override
public
int
deleteShopRecommendByIds
(
String
[]
ids
)
{
return
shopRecommendMapper
.
deleteShopRecommendByIds
(
ids
);
}
/**
* 删除推荐和今日特惠信息
*
* @param id 推荐和今日特惠主键
* @return 结果
*/
@Override
public
int
deleteShopRecommendById
(
String
id
)
{
return
shopRecommendMapper
.
deleteShopRecommendById
(
id
);
}
// /**
// * 批量删除推荐和今日特惠
// *
// * @param ids 需要删除的推荐和今日特惠主键
// * @return 结果
// */
// @Override
// public int deleteShopRecommendByIds(String[] ids) {
// return shopRecommendMapper.deleteShopRecommendByIds(ids);
// }
//
// /**
// * 删除推荐和今日特惠信息
// *
// * @param id 推荐和今日特惠主键
// * @return 结果
// */
// @Override
// public int deleteShopRecommendById(String id) {
// return shopRecommendMapper.deleteShopRecommendById(id);
// }
@Override
public
String
turn
(
Long
shopId
,
String
goodsId
,
String
pointer
,
String
type
)
{
ShopRecommend
shopRecommend
=
new
ShopRecommend
();
shopRecommend
.
setShopId
(
String
.
valueOf
(
shopId
));
shopRecommend
.
setType
(
type
);
List
<
ShopRecommend
>
shopRecommends
=
shopRecommendMapper
.
selectShopRecommendList
(
shopRecommend
);
int
size
=
shopRecommends
.
size
();
String
lastGoodsId
=
null
;
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
ShopRecommend
shopGood
=
shopRecommends
.
get
(
i
);
if
(
goodsId
.
equals
(
shopGood
.
getGoodsId
()))
{
if
(
"1"
.
equals
(
pointer
))
{
int
index
=
i
-
1
;
if
(
index
<
0
)
{
lastGoodsId
=
shopGood
.
getGoodsId
();
}
else
{
if
(
goodsId
.
equals
(
shopGood
.
getGoodsId
()))
{
if
(
"1"
.
equals
(
pointer
))
{
int
index
=
i
-
1
;
if
(
index
<
0
)
{
lastGoodsId
=
shopGood
.
getGoodsId
();
}
else
{
lastGoodsId
=
shopRecommends
.
get
(
index
).
getGoodsId
();
}
}
else
if
(
"2"
.
equals
(
pointer
))
{
int
index
=
i
+
1
;
if
(
index
>=
size
)
{
lastGoodsId
=
shopGood
.
getGoodsId
();
}
else
{
}
else
if
(
"2"
.
equals
(
pointer
))
{
int
index
=
i
+
1
;
if
(
index
>=
size
)
{
lastGoodsId
=
shopGood
.
getGoodsId
();
}
else
{
lastGoodsId
=
shopRecommends
.
get
(
index
).
getGoodsId
();
}
}
...
...
@@ -166,7 +170,7 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
}
shopRecommend
.
setGoodsId
(
goodsId
);
ShopRecommend
frist
=
shopRecommendMapper
.
selectShopRecommendList
(
shopRecommend
).
get
(
0
);
String
turn
=
frist
.
getTurn
();
String
turn
=
frist
.
getTurn
();
shopRecommend
.
setGoodsId
(
lastGoodsId
);
ShopRecommend
last
=
shopRecommendMapper
.
selectShopRecommendList
(
shopRecommend
).
get
(
0
);
frist
.
setTurn
(
last
.
getTurn
());
...
...
@@ -185,6 +189,9 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
shopRecommend
.
setGoodsId
(
goodsId
);
ShopRecommend
frist
=
shopRecommendMapper
.
selectShopRecommendList
(
shopRecommend
).
get
(
0
);
updateApplication
(
Long
.
parseLong
(
shopRecommend
.
getShopId
()));
if
(!
StringUtils
.
isEmpty
(
type
)
&&
type
.
equals
(
"2"
))
{
shopGoodsSkuService
.
restoreSkuDiscount
(
Long
.
parseLong
(
shopId
),
Long
.
parseLong
(
goodsId
));
}
return
shopRecommendMapper
.
deleteShopRecommendById
(
frist
.
getId
());
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
View file @
6ad67b28
...
...
@@ -33,8 +33,7 @@ import java.util.stream.Collectors;
*/
@Service
@Slf4j
public
class
ShopServiceImpl
implements
IShopService
{
public
class
ShopServiceImpl
implements
IShopService
{
@Autowired
private
ShopMapper
shopMapper
;
@Autowired
...
...
@@ -60,13 +59,12 @@ public class ShopServiceImpl implements IShopService
/**
* 查询店铺
*
*
* @param id 店铺主键
* @return 店铺
*/
@Override
public
Shop
selectShopById
(
Long
id
)
{
public
Shop
selectShopById
(
Long
id
)
{
Shop
shop
=
shopMapper
.
selectShopById
(
id
);
if
(
shop
.
getDistanceLimit
()
!=
null
&&
shop
.
getDistanceLimit
().
equals
(
0.0
))
{
shop
.
setDistanceLimit
(
null
);
...
...
@@ -76,13 +74,12 @@ public class ShopServiceImpl implements IShopService
/**
* 查询店铺列表
*
*
* @param shop 店铺
* @return 店铺
*/
@Override
public
List
<
Shop
>
selectShopList
(
Shop
shop
)
{
public
List
<
Shop
>
selectShopList
(
Shop
shop
)
{
List
<
Shop
>
shops
=
shopMapper
.
selectShopList
(
shop
);
for
(
Shop
shop1
:
shops
)
{
Machine
machine
=
new
Machine
();
...
...
@@ -175,13 +172,12 @@ public class ShopServiceImpl implements IShopService
/**
* 批量删除店铺
*
*
* @param ids 需要删除的店铺主键
* @return 结果
*/
@Override
public
int
deleteShopByIds
(
String
[]
ids
)
{
public
int
deleteShopByIds
(
String
[]
ids
)
{
for
(
String
id
:
ids
)
{
Shop
shop
=
new
Shop
();
shop
.
setId
(
Long
.
parseLong
(
id
));
...
...
@@ -197,7 +193,7 @@ public class ShopServiceImpl implements IShopService
String
[]
goodsIdString
=
goodsIds
.
split
(
","
);
for
(
String
s
:
goodsIdString
)
{
Long
goodsId
=
Long
.
parseLong
(
s
);
addGoods
(
shopId
,
goodsId
);
addGoods
(
shopId
,
goodsId
);
}
return
null
;
...
...
@@ -220,7 +216,7 @@ public class ShopServiceImpl implements IShopService
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
shopId
);
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
if
(
machines
==
null
||
machines
.
isEmpty
())
{
if
(
machines
==
null
||
machines
.
isEmpty
())
{
throw
new
ServiceException
(
"请先绑定机器"
);
}
for
(
Machine
machine1
:
machines
)
{
...
...
@@ -233,6 +229,8 @@ public class ShopServiceImpl implements IShopService
shopGoodsSku
.
setIsDeleted
(
"0"
);
shopGoodsSku
.
setCreatedAt
(
new
Date
());
shopGoodsSku
.
setUpdatedAt
(
new
Date
());
shopGoodsSku
.
setOrigDiscount
(
skus
.
getDiscount
());
shopGoodsSku
.
setDiscount
(
skus
.
getDiscount
());
shopGoodsSkuMapper
.
insertShopGoodsSku
(
shopGoodsSku
);
}
updateApplication
(
Integer
.
parseInt
(
machine1
.
getId
()));
...
...
@@ -280,6 +278,11 @@ public class ShopServiceImpl implements IShopService
}
}
Integer
selloutCount
=
shopGoodsSkuMapper
.
getSelloutSkuCount
(
shopId
,
goods
.
getId
());
Integer
sellinCount
=
shopGoodsSkuMapper
.
getSellinSkuCount
(
shopId
,
goods
.
getId
());
goods
.
setSelloutCount
(
selloutCount
);
goods
.
setSkuCount
(
sellinCount
+
selloutCount
);
ShopRecommend
shopRecommend
=
new
ShopRecommend
();
shopRecommend
.
setShopId
(
String
.
valueOf
(
shopId
));
shopRecommend
.
setGoodsId
(
String
.
valueOf
(
goods
.
getId
()));
...
...
@@ -287,15 +290,15 @@ public class ShopServiceImpl implements IShopService
goods
.
setPreferential
(
"1"
);
goods
.
setRecommend
(
"1"
);
List
<
ShopRecommend
>
shopRecommends
=
shopRecommendMapper
.
selectShopRecommendList
(
shopRecommend
);
if
(
shopRecommends
.
size
()>
0
)
{
if
(
shopRecommends
.
size
()
>
0
)
{
goods
.
setRecommend
(
"0"
);
}
shopRecommend
.
setType
(
"2"
);
shopRecommends
=
shopRecommendMapper
.
selectShopRecommendList
(
shopRecommend
);
if
(
shopRecommends
.
size
()>
0
)
{
if
(
shopRecommends
.
size
()
>
0
)
{
goods
.
setPreferential
(
"0"
);
}
goods
.
setSalesVolume
(
orderMapper
.
selectSalesVolume
(
shopId
,
goods
.
getId
()));
goods
.
setSalesVolume
(
orderMapper
.
selectSalesVolume
(
shopId
,
goods
.
getId
()));
}
category
.
setGoodsList
(
goodsList
);
}
...
...
@@ -304,7 +307,7 @@ public class ShopServiceImpl implements IShopService
@Override
public
List
<
GoodsSku
>
getSkuByGoodsId
(
long
shopId
,
long
goodsId
)
{
return
shopGoodsSkuMapper
.
selectSkuByShopAndGoods
(
shopId
,
goodsId
);
return
shopGoodsSkuMapper
.
selectSkuByShopAndGoods
(
shopId
,
goodsId
);
}
...
...
@@ -358,8 +361,8 @@ public class ShopServiceImpl implements IShopService
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
shopId
);
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
if
(!
machines
.
isEmpty
())
{
Machine
machine1
=
machines
.
get
(
0
);
if
(!
machines
.
isEmpty
())
{
Machine
machine1
=
machines
.
get
(
0
);
updateApplication
(
Integer
.
parseInt
(
machine1
.
getId
()));
}
return
null
;
...
...
@@ -404,10 +407,10 @@ public class ShopServiceImpl implements IShopService
List
<
Goods
>
goodsList
=
shopGoodsMapper
.
selectShopNoAddGoods
(
goodsName
,
category
,
shopId
);
for
(
Goods
goods1
:
goodsList
)
{
GoodsCategory
goodsCategory
=
goodsCategoryMapper
.
selectGoodsCategoryById
(
goods1
.
getCategory
());
if
(
goodsCategory
!=
null
)
{
if
(
goodsCategory
!=
null
)
{
goods1
.
setCategoryName
(
goodsCategory
.
getName
());
}
int
count
=
orderMapper
.
selectSalesVolume
(
null
,
goods1
.
getId
());
int
count
=
orderMapper
.
selectSalesVolume
(
null
,
goods1
.
getId
());
goods1
.
setSalesVolume
(
count
);
}
return
goodsList
;
...
...
@@ -473,7 +476,7 @@ public class ShopServiceImpl implements IShopService
}
private
JSONArray
buildGoodsSpec
(
String
specs
)
{
List
<
Spec
>
specList
=
JSONObject
.
parseArray
(
specs
,
Spec
.
class
);
List
<
Spec
>
specList
=
JSONObject
.
parseArray
(
specs
,
Spec
.
class
);
List
<
SpecVo
>
specVos
=
new
ArrayList
<>();
for
(
Spec
spec
:
specList
)
{
SpecVo
specVo
=
new
SpecVo
();
...
...
@@ -521,7 +524,7 @@ public class ShopServiceImpl implements IShopService
}
}
skuVo
.
setIsDefault
(
"0"
);
if
(
boo
)
{
if
(
boo
)
{
skuVo
.
setIsDefault
(
"1"
);
}
skuVo
.
setRules
(
JSONObject
.
parseArray
(
JSONObject
.
toJSONString
(
skuRuleVos
)));
...
...
soss-system/src/main/java/com/soss/system/service/impl/SysBannerServiceImpl.java
0 → 100644
View file @
6ad67b28
package
com
.
soss
.
system
.
service
.
impl
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.Shop
;
import
com.soss.system.domain.SysBanner
;
import
com.soss.system.mapper.SysBannerMapper
;
import
com.soss.system.service.ISysBannerService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
/**
* 轮播图Service业务层处理
*
* @author zxq
* @date 2022-04-28
*/
@Service
@Slf4j
public
class
SysBannerServiceImpl
implements
ISysBannerService
{
@Autowired
private
SysBannerMapper
sysBannerMapper
;
@Autowired
private
ShopServiceImpl
shopService
;
@Override
public
List
<
SysBanner
>
selectBanner
(
SysBanner
banner
)
{
return
sysBannerMapper
.
selectBanner
(
banner
);
}
@Override
public
Long
createBanner
(
SysBanner
banner
)
{
if
(
StringUtils
.
isEmpty
(
banner
.
getImage
()))
{
throw
new
ServiceException
(
"图片地址不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
banner
.
getPage
()))
{
throw
new
ServiceException
(
"链接地址不能为空"
);
}
if
(
banner
.
getType
()
==
null
||
banner
.
getType
()
<
1
||
banner
.
getType
()
>
3
)
{
throw
new
ServiceException
(
"类型不正确,1-小程序,2-KDS,3-点单屏"
);
}
if
(
banner
.
getTarget
()
==
null
||
banner
.
getTarget
()
<
1
||
banner
.
getTarget
()
>
2
)
{
throw
new
ServiceException
(
"轮播位置不正确,1-小程序首页,2-小程序我的"
);
}
if
(
banner
.
getSort
()
==
null
)
{
throw
new
ServiceException
(
"轮播顺序不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
banner
.
getProvince
())
&&
StringUtils
.
isEmpty
(
banner
.
getCity
())
&&
StringUtils
.
isEmpty
(
banner
.
getArea
())
&&
StringUtils
.
isEmpty
(
banner
.
getShopIds
()))
{
throw
new
ServiceException
(
"适用范围不能为空"
);
}
banner
.
setCreatedAt
(
new
Date
());
banner
.
setUpdatedAt
(
new
Date
());
banner
.
setState
(
0
);
long
i
=
sysBannerMapper
.
createBanner
(
banner
);
return
banner
.
getId
();
}
@Override
public
Boolean
updateBanner
(
SysBanner
banner
)
{
if
(
banner
.
getId
()
==
null
||
banner
.
getId
()
<=
0
)
{
throw
new
ServiceException
(
"id不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
banner
.
getImage
()))
{
throw
new
ServiceException
(
"图片地址不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
banner
.
getPage
()))
{
throw
new
ServiceException
(
"链接地址不能为空"
);
}
if
(
banner
.
getType
()
==
null
||
banner
.
getType
()
<
1
||
banner
.
getType
()
>
3
)
{
throw
new
ServiceException
(
"类型不正确,1-小程序,2-KDS,3-点单屏"
);
}
if
(
banner
.
getTarget
()
==
null
||
banner
.
getTarget
()
<
1
||
banner
.
getTarget
()
>
2
)
{
throw
new
ServiceException
(
"轮播位置不正确,1-小程序首页,2-小程序我的"
);
}
if
(
banner
.
getSort
()
==
null
)
{
throw
new
ServiceException
(
"轮播顺序不能为空"
);
}
if
(
StringUtils
.
isEmpty
(
banner
.
getProvince
())
&&
StringUtils
.
isEmpty
(
banner
.
getCity
())
&&
StringUtils
.
isEmpty
(
banner
.
getArea
())
&&
StringUtils
.
isEmpty
(
banner
.
getShopIds
()))
{
throw
new
ServiceException
(
"适用范围不能为空"
);
}
banner
.
setUpdatedAt
(
new
Date
());
long
i
=
sysBannerMapper
.
updateBanner
(
banner
);
return
i
>
0
?
true
:
false
;
}
@Override
public
Boolean
updateState
(
Long
bannerId
,
Integer
state
)
{
SysBanner
banner
=
new
SysBanner
();
banner
.
setId
(
bannerId
);
banner
.
setState
(
state
);
banner
.
setUpdatedAt
(
new
Date
());
if
(
banner
.
getId
()
==
null
||
banner
.
getId
()
<=
0
)
{
throw
new
ServiceException
(
"id不能为空"
);
}
if
(
banner
.
getState
()
==
null
||
banner
.
getState
()
<
0
||
banner
.
getState
()
>
1
)
{
throw
new
ServiceException
(
"状态不正确,0-上线,1-下线"
);
}
long
i
=
sysBannerMapper
.
updateState
(
banner
);
return
i
>
0
?
true
:
false
;
}
@Override
public
Boolean
delete
(
Long
bannerId
)
{
long
i
=
sysBannerMapper
.
delete
(
bannerId
);
return
i
>
0
?
true
:
false
;
}
@Override
public
List
<
SysBanner
>
getBannersByShopId
(
Long
shopId
,
Integer
type
,
Integer
target
)
{
List
<
SysBanner
>
banners
=
sysBannerMapper
.
selectBanners
(
type
,
target
);
if
(
CollectionUtils
.
isEmpty
(
banners
))
{
log
.
info
(
"banner list is empty"
);
return
null
;
}
Shop
shop
=
shopService
.
selectShopById
(
shopId
);
if
(
shop
==
null
)
{
log
.
info
(
"shop is null"
);
return
null
;
}
List
<
SysBanner
>
list
=
new
ArrayList
<>();
banners
.
forEach
(
banner
->
{
if
(!
StringUtils
.
isEmpty
(
banner
.
getProvince
()))
{
Arrays
.
stream
(
banner
.
getProvince
().
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
shop
.
getProvince
()))
{
list
.
add
(
banner
);
return
;
}
});
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getCity
()))
{
Arrays
.
stream
(
banner
.
getCity
().
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
shop
.
getCity
()))
{
list
.
add
(
banner
);
return
;
}
});
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getArea
()))
{
Arrays
.
stream
(
banner
.
getArea
().
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
shop
.
getZone
()))
{
list
.
add
(
banner
);
return
;
}
});
}
if
(!
StringUtils
.
isEmpty
(
banner
.
getShopIds
()))
{
Arrays
.
stream
(
banner
.
getShopIds
().
split
(
","
)).
forEach
(
p
->
{
if
(
p
.
equals
(
String
.
valueOf
(
shop
.
getId
())))
{
list
.
add
(
banner
);
return
;
}
});
}
});
return
list
;
}
}
soss-system/src/main/resources/mapper/system/GoodsMapper.xml
View file @
6ad67b28
...
...
@@ -50,7 +50,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"code != null and code != ''"
>
and code = #{code}
</if>
</where>
order by created_at desc
</select>
...
...
soss-system/src/main/resources/mapper/system/ShopGoodsMapper.xml
View file @
6ad67b28
...
...
@@ -93,9 +93,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
g.shelf_at as shelfAt,
g.code,
'1' as state
from shop_goods sg ,goods g where sg.goods_id =g.id and g.state ='3' and g.is_deleted =0
and shop_id =#{shopId} and category like concat('%,', #{categoryId}, ',%')
from shop_goods sg, goods g where sg.goods_id = g.id and g.state ='3' and g.is_deleted = 0
and shop_id = #{shopId} and category like concat('%,', #{categoryId}, ',%')
order by sg.turn
</select>
<select
id=
"selectShopNoAddGoods"
resultType=
"com.soss.system.domain.Goods"
>
...
...
soss-system/src/main/resources/mapper/system/ShopGoodsSkuMapper.xml
View file @
6ad67b28
...
...
@@ -33,6 +33,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
</where>
</select>
<select
id=
"getSelloutSkuCount"
resultType=
"Integer"
>
select count(1) from shop_goods_sku where shop_id=#{shopId} and goods_id=#{goodsId} and `state`!=1
</select>
<select
id=
"getSellinSkuCount"
resultType=
"Integer"
>
select count(1) from shop_goods_sku where shop_id=#{shopId} and goods_id=#{goodsId} and `state`=1
</select>
<select
id=
"selectShopGoodsSkuById"
parameterType=
"String"
resultMap=
"ShopGoodsSkuResult"
>
<include
refid=
"selectShopGoodsSkuVo"
/>
...
...
@@ -50,6 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"isDeleted != null and isDeleted != ''"
>
is_deleted,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"origDiscount != null"
>
orig_discount,
</if>
<if
test=
"discount != null"
>
discount,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"shopId != null and shopId != ''"
>
#{shopId},
</if>
...
...
@@ -60,6 +70,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"isDeleted != null and isDeleted != ''"
>
#{isDeleted},
</if>
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"origDiscount != null"
>
#{origDiscount},
</if>
<if
test=
"discount != null"
>
#{discount},
</if>
</trim>
</insert>
...
...
@@ -96,23 +108,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select
id=
"selectSkuByGoodAndShop"
resultType=
"com.soss.system.domain.vo.orderTaking.SkuVo"
>
select
sgs.id as id,
gs.id as skuId,
sgs.state as state ,
gs.price as price,
gs.discount as discount,
gs.rule_list as rulesString,
gs.is_deleted isDelete
gs.is_deleted isDelete,
sgs.state,
case when sgs.discount>0 then sgs.discount else gs.discount end discount,
case when sgs.orig_discount>0 then sgs.orig_discount else gs.discount end orig_discount
from
goods_sku gs ,
shop_goods_sku sgs
where
gs.id = sgs.sku_id
<!-- and gs.is_deleted = '0' -->
and gs.is_deleted in (0, 2)
and sgs.goods_id =#{goodsId}
and sgs.shop_id =#{shopId}
</select>
<update
id=
"updateSkuDiscount"
>
update shop_goods_sku set discount = #{discount} where id = #{id}
</update>
<update
id=
"restoreSkuDiscount"
>
update shop_goods_sku set discount = orig_discount where shop_id = #{shopId} and goods_id = #{goodsId}
</update>
<update
id=
"updateSkuStatus"
>
update shop_goods_sku set state =#{status}
<where>
...
...
soss-system/src/main/resources/mapper/system/ShopRecommendMapper.xml
View file @
6ad67b28
...
...
@@ -67,6 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"recommendPrice != null"
>
recommend_price,
</if>
<if
test=
"recommendTag != null"
>
recommend_tag,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"shopId != null and shopId != ''"
>
#{shopId},
</if>
...
...
@@ -82,6 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"name != null"
>
#{name},
</if>
<if
test=
"recommendPrice != null"
>
#{recommendPrice},
</if>
<if
test=
"recommendTag != null"
>
#{recommendTag},
</if>
</trim>
</insert>
...
...
@@ -132,7 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and sr.shop_id =#{shopId}
and sr.state ='1' and g.is_deleted ='0'
order by
sr.turn
sr.recommend_price desc,
sr.turn
</select>
<select
id=
"selectShopRecommendGoods"
resultType=
"com.soss.system.domain.Goods"
>
select
...
...
@@ -147,9 +151,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
g.`desc`,
g.remarks,
g.code,
sr.rec_date as recommendDate
sr.rec_date as recommendDate,
sr.recommend_price,
sr.recommend_tag
from
shop
s ,
shop s ,
shop_recommend sr,
goods g
where
...
...
soss-system/src/main/resources/mapper/system/SpecMapper.xml
View file @
6ad67b28
...
...
@@ -42,6 +42,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
and is_deleted = 0
</select>
<select
id=
"selectSpecByIds"
resultMap=
"SpecResult"
>
<include
refid=
"selectSpecVo"
/>
where id in
<foreach
item=
"id"
collection=
"ids"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</select>
<insert
id=
"insertSpec"
parameterType=
"Spec"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into spec
...
...
soss-system/src/main/resources/mapper/system/SysBannerMapper.xml
0 → 100644
View file @
6ad67b28
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.soss.system.mapper.SysBannerMapper"
>
<resultMap
type=
"SysBanner"
id=
"BannerResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"image"
column=
"image"
/>
<result
property=
"page"
column=
"page"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"target"
column=
"target"
/>
<result
property=
"province"
column=
"province"
/>
<result
property=
"city"
column=
"city"
/>
<result
property=
"area"
column=
"area"
/>
<result
property=
"shopIds"
column=
"shop_ids"
/>
<result
property=
"sort"
column=
"sort"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"createdAt"
column=
"created_at"
/>
<result
property=
"updatedAt"
column=
"updated_at"
/>
</resultMap>
<select
id=
"selectBanner"
resultMap=
"BannerResult"
parameterType=
"SysBanner"
>
select * from sys_banner
<where>
<if
test=
"type != null "
>
type = #{type}
</if>
<if
test=
"target != null "
>
and target = #{target}
</if>
<if
test=
"province != null and province != ''"
>
and province like concat('%', #{province}, '%')
</if>
<if
test=
"city != null and city != ''"
>
and city like concat('%', #{city}, '%')
</if>
<if
test=
"area != null and area != ''"
>
and area like concat('%', #{area}, '%')
</if>
<if
test=
"shopIds != null and shopIds != ''"
>
and shop_ids like concat('%', #{shopIds}, '%')
</if>
<if
test=
"state != null "
>
and state = #{state}
</if>
</where>
order by created_at desc
</select>
<insert
id=
"createBanner"
parameterType=
"SysBanner"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into sys_banner(image, page, `type`, target, province, city, area, shop_ids, `sort`, `state`, created_at, updated_at)
values (#{image},#{page},#{type},#{target},#{province},#{city},#{area},#{shopIds},#{sort},#{state},#{createdAt},#{updatedAt})
</insert>
<insert
id=
"updateBanner"
parameterType=
"SysBanner"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
update sys_banner set
image = #{image},
page = #{page},
`type` = #{type},
target = #{target},
province = #{province},
city = #{city},
area = #{area},
shop_ids = #{shopIds},
`sort` = #{sort},
updated_at = #{updatedAt}
where id = #{id}
</insert>
<insert
id=
"updateState"
parameterType=
"SysBanner"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
update sys_banner set `state` = #{state}, updated_at = #{updatedAt} where id = #{id}
</insert>
<insert
id=
"delete"
parameterType=
"Long"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
delete from sys_banner where id = #{id}
</insert>
<select
id=
"selectBanners"
resultMap=
"BannerResult"
>
select * from sys_banner where `type` = #{type} and `target` = #{target} and `state` = 0 order by sort, created_at
</select>
</mapper>
\ 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