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
22665e2b
Commit
22665e2b
authored
Feb 22, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下单时校验订单中sku数量
parent
86c0b006
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
6 deletions
+80
-6
soss-admin/src/main/java/com/soss/web/controller/system/BannerController.java
+3
-2
soss-system/src/main/java/com/soss/system/domain/po/BannerPo.java
+44
-0
soss-system/src/main/java/com/soss/system/service/ISysBannerService.java
+3
-2
soss-system/src/main/java/com/soss/system/service/impl/SysBannerServiceImpl.java
+30
-2
No files found.
soss-admin/src/main/java/com/soss/web/controller/system/BannerController.java
View file @
22665e2b
...
...
@@ -6,6 +6,7 @@ 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.domain.po.BannerPo
;
import
com.soss.system.service.ISysBannerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -38,7 +39,7 @@ public class BannerController extends BaseController {
* @return
*/
@PostMapping
(
"/create"
)
public
AjaxResult
create
(
@RequestBody
SysBanner
banner
)
{
public
AjaxResult
create
(
@RequestBody
BannerPo
banner
)
{
try
{
return
AjaxResult
.
success
(
bannerService
.
createBanner
(
banner
));
}
catch
(
ServiceException
serviceException
)
{
...
...
@@ -53,7 +54,7 @@ public class BannerController extends BaseController {
* @return
*/
@PostMapping
(
"/update"
)
public
AjaxResult
update
(
@RequestBody
SysBanner
banner
)
{
public
AjaxResult
update
(
@RequestBody
BannerPo
banner
)
{
try
{
return
AjaxResult
.
success
(
bannerService
.
updateBanner
(
banner
));
}
catch
(
ServiceException
serviceException
)
{
...
...
soss-system/src/main/java/com/soss/system/domain/po/BannerPo.java
0 → 100644
View file @
22665e2b
package
com
.
soss
.
system
.
domain
.
po
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"轮播图请求类"
)
public
class
BannerPo
{
/** 主键 */
private
Long
id
;
/**
* 图片url
*/
private
String
image
;
/**
* 页面url
*/
private
String
page
;
/**
* 类型:1-小程序,2-KDS,3-点单屏
*/
private
Integer
type
;
/**
* 目标:1-小程序首页,2-小程序我的
*/
private
Integer
target
;
/**
* 排序
*/
private
Integer
sort
;
@ApiModelProperty
(
"可用省份列表,全国通用传 [0]"
)
private
String
[]
province
;
@ApiModelProperty
(
"可用城市列表"
)
private
String
[]
city
;
@ApiModelProperty
(
"可用区域列表"
)
private
String
[]
area
;
@ApiModelProperty
(
"可用店铺ID列表"
)
private
Long
[]
shopIds
;
}
soss-system/src/main/java/com/soss/system/service/ISysBannerService.java
View file @
22665e2b
package
com
.
soss
.
system
.
service
;
import
com.soss.system.domain.SysBanner
;
import
com.soss.system.domain.po.BannerPo
;
import
java.util.List
;
...
...
@@ -13,9 +14,9 @@ import java.util.List;
public
interface
ISysBannerService
{
List
<
SysBanner
>
selectBanner
(
SysBanner
banner
);
Long
createBanner
(
SysBanner
banner
);
Long
createBanner
(
BannerPo
banner
);
Boolean
updateBanner
(
SysBanner
banner
);
Boolean
updateBanner
(
BannerPo
banner
);
Boolean
updateState
(
Long
bannerId
,
Integer
state
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/SysBannerServiceImpl.java
View file @
22665e2b
...
...
@@ -4,6 +4,7 @@ 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.domain.po.BannerPo
;
import
com.soss.system.mapper.SysBannerMapper
;
import
com.soss.system.service.ISysBannerService
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -15,6 +16,7 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 轮播图Service业务层处理
...
...
@@ -36,7 +38,8 @@ public class SysBannerServiceImpl implements ISysBannerService {
}
@Override
public
Long
createBanner
(
SysBanner
banner
)
{
public
Long
createBanner
(
BannerPo
bannerPo
)
{
SysBanner
banner
=
copyBanner
(
bannerPo
);
if
(
StringUtils
.
isEmpty
(
banner
.
getImage
()))
{
throw
new
ServiceException
(
"图片地址不能为空"
);
}
...
...
@@ -64,7 +67,8 @@ public class SysBannerServiceImpl implements ISysBannerService {
}
@Override
public
Boolean
updateBanner
(
SysBanner
banner
)
{
public
Boolean
updateBanner
(
BannerPo
bannerPo
)
{
SysBanner
banner
=
copyBanner
(
bannerPo
);
if
(
banner
.
getId
()
==
null
||
banner
.
getId
()
<=
0
)
{
throw
new
ServiceException
(
"id不能为空"
);
}
...
...
@@ -93,6 +97,30 @@ public class SysBannerServiceImpl implements ISysBannerService {
return
i
>
0
?
true
:
false
;
}
private
SysBanner
copyBanner
(
BannerPo
bannerPo
)
{
SysBanner
banner
=
new
SysBanner
();
banner
.
setId
(
bannerPo
.
getId
());
banner
.
setImage
(
bannerPo
.
getImage
());
banner
.
setPage
(
bannerPo
.
getPage
());
banner
.
setType
(
bannerPo
.
getType
());
banner
.
setTarget
(
bannerPo
.
getTarget
());
banner
.
setSort
(
bannerPo
.
getSort
());
if
(
bannerPo
.
getProvince
()
!=
null
&&
bannerPo
.
getProvince
().
length
>
0
)
{
banner
.
setProvince
(
Arrays
.
asList
(
bannerPo
.
getProvince
()).
stream
().
collect
(
Collectors
.
joining
(
","
)));
}
if
(
bannerPo
.
getCity
()
!=
null
&&
bannerPo
.
getCity
().
length
>
0
)
{
banner
.
setCity
(
Arrays
.
asList
(
bannerPo
.
getCity
()).
stream
().
collect
(
Collectors
.
joining
(
","
)));
}
if
(
bannerPo
.
getArea
()
!=
null
&&
bannerPo
.
getArea
().
length
>
0
)
{
banner
.
setArea
(
Arrays
.
asList
(
bannerPo
.
getArea
()).
stream
().
collect
(
Collectors
.
joining
(
","
)));
}
if
(
bannerPo
.
getShopIds
()
!=
null
&&
bannerPo
.
getShopIds
().
length
>
0
)
{
banner
.
setShopIds
(
Arrays
.
asList
(
bannerPo
.
getShopIds
()).
stream
().
map
(
x
->
String
.
valueOf
(
x
)).
collect
(
Collectors
.
joining
(
","
)));
}
return
banner
;
}
@Override
public
Boolean
updateState
(
Long
bannerId
,
Integer
state
)
{
SysBanner
banner
=
new
SysBanner
();
...
...
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