Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
0c22774d
Commit
0c22774d
authored
Oct 12, 2020
by
wuwz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
热门游
parent
cc7225dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
489 additions
and
445 deletions
+489
-445
TourTag.java
.../src/main/java/com/xxfc/platform/tour/entity/TourTag.java
+110
-107
TourTagBiz.java
.../src/main/java/com/xxfc/platform/tour/biz/TourTagBiz.java
+276
-258
TourTagController.java
...n/java/com/xxfc/platform/tour/rest/TourTagController.java
+103
-80
No files found.
xx-tour/xx-tour-api/src/main/java/com/xxfc/platform/tour/entity/TourTag.java
View file @
0c22774d
package
com
.
xxfc
.
platform
.
tour
.
entity
;
package
com
.
xxfc
.
platform
.
tour
.
entity
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.List
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
/**
/**
* 旅游路线标签
* 旅游路线标签
*
*
* @author zjw
* @author zjw
* @email nishijjo@qq.com
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
* @date 2019-06-06 11:41:51
*/
*/
@Data
@Data
@Table
(
name
=
"tour_tag"
)
@Table
(
name
=
"tour_tag"
)
@Builder
@Builder
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
public
class
TourTag
implements
Serializable
{
public
class
TourTag
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/**
/**
* 主键id
* 主键id
*/
*/
@Id
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
@GeneratedValue
(
generator
=
"JDBC"
)
@ApiModelProperty
(
"主键id"
)
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
private
Integer
id
;
/**
/**
* 名称
* 名称
*/
*/
@Column
(
name
=
"name"
)
@Column
(
name
=
"name"
)
@ApiModelProperty
(
value
=
"名称"
)
@ApiModelProperty
(
value
=
"名称"
)
private
String
name
;
private
String
name
;
/**
/**
* 图片
* 图片
*/
*/
@Column
(
name
=
"img"
)
@Column
(
name
=
"img"
)
@ApiModelProperty
(
value
=
"图片"
)
@ApiModelProperty
(
value
=
"图片"
)
private
String
img
;
private
String
img
;
/**
/**
* 描述
* 描述
*/
*/
@Column
(
name
=
"describe"
)
@Column
(
name
=
"describe"
)
@ApiModelProperty
(
value
=
"描述"
)
@ApiModelProperty
(
value
=
"描述"
)
private
String
describe
;
private
String
describe
;
/**
/**
* 链接
* 链接
*/
*/
@Column
(
name
=
"link"
)
@Column
(
name
=
"link"
)
@ApiModelProperty
(
value
=
"链接"
)
@ApiModelProperty
(
value
=
"链接"
)
private
String
link
;
private
String
link
;
/**
/**
* 是否热门:0-否;1-是
* 是否热门:0-否;1-是
*/
*/
@Column
(
name
=
"is_hot"
)
@Column
(
name
=
"is_hot"
)
@ApiModelProperty
(
value
=
"是否热门:0-否;1-是"
)
@ApiModelProperty
(
value
=
"是否热门:0-否;1-是"
)
private
Integer
isHot
;
private
Integer
isHot
;
/**
/**
* 成单量
* 成单量
*/
*/
@Column
(
name
=
"count"
)
@Column
(
name
=
"count"
)
@ApiModelProperty
(
value
=
"成单量"
)
@ApiModelProperty
(
value
=
"成单量"
)
private
Integer
count
;
private
Integer
count
;
/**
/**
* 排序
* 排序
*/
*/
@Column
(
name
=
"rank"
)
@Column
(
name
=
"rank"
)
@ApiModelProperty
(
value
=
"排序"
)
@ApiModelProperty
(
value
=
"排序"
)
private
Integer
rank
;
private
Integer
rank
;
/**
/**
* 创建时间
* 创建时间
*/
*/
@Column
(
name
=
"ctr_time"
)
@Column
(
name
=
"ctr_time"
)
@ApiModelProperty
(
value
=
"创建时间"
)
@ApiModelProperty
(
value
=
"创建时间"
)
private
Long
ctrTime
;
private
Long
ctrTime
;
/**
/**
* 更新时间
* 更新时间
*/
*/
@Column
(
name
=
"upd_time"
)
@Column
(
name
=
"upd_time"
)
@ApiModelProperty
(
value
=
"更新时间"
,
hidden
=
true
)
@ApiModelProperty
(
value
=
"更新时间"
,
hidden
=
true
)
private
Long
updTime
;
private
Long
updTime
;
/**
/**
* 是否删除:0-正常;1-删除
* 是否删除:0-正常;1-删除
*/
*/
@Column
(
name
=
"is_del"
)
@Column
(
name
=
"is_del"
)
@ApiModelProperty
(
value
=
"是否删除:0-正常;1-删除"
)
@ApiModelProperty
(
value
=
"是否删除:0-正常;1-删除"
)
private
Integer
isDel
;
private
Integer
isDel
;
}
@Transient
private
List
<
TourGood
>
list
;
}
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/biz/TourTagBiz.java
View file @
0c22774d
package
com
.
xxfc
.
platform
.
tour
.
biz
;
package
com
.
xxfc
.
platform
.
tour
.
biz
;
import
com.ace.cache.annotation.CacheClear
;
import
com.ace.cache.annotation.CacheClear
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.tour.comstnt.RedisKey
;
import
com.xxfc.platform.tour.comstnt.RedisKey
;
import
com.xxfc.platform.tour.dto.TourTagAndBannerDTO
;
import
com.xxfc.platform.tour.dto.TourTagAndBannerDTO
;
import
com.xxfc.platform.tour.dto.TourTagBannerDTO
;
import
com.xxfc.platform.tour.dto.TourTagBannerDTO
;
import
com.xxfc.platform.tour.dto.TourTagDTO
;
import
com.xxfc.platform.tour.dto.TourTagDTO
;
import
com.xxfc.platform.tour.mapper.TourTagMapper
;
import
com.xxfc.platform.tour.entity.TourGood
;
import
lombok.extern.slf4j.Slf4j
;
import
com.xxfc.platform.tour.mapper.TourGoodMapper
;
import
org.apache.commons.collections.CollectionUtils
;
import
com.xxfc.platform.tour.mapper.TourTagMapper
;
import
org.springframework.beans.BeanUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.xxfc.platform.tour.entity.TourTag
;
import
org.springframework.stereotype.Service
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.xxfc.platform.tour.entity.TourTag
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
java.time.Instant
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.time.Instant
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
* 旅游路线标签
* 旅游路线标签
*
*
* @author zjw
* @author zjw
* @email nishijjo@qq.com
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
* @date 2019-06-06 11:41:51
*/
*/
@Service
@Service
@Slf4j
@Slf4j
public
class
TourTagBiz
extends
BaseBiz
<
TourTagMapper
,
TourTag
>
{
public
class
TourTagBiz
extends
BaseBiz
<
TourTagMapper
,
TourTag
>
{
@Autowired
@Autowired
private
TourTagBannerBiz
tourTagBannerBiz
;
private
TourTagBannerBiz
tourTagBannerBiz
;
@Autowired
// @Cache(key = RedisKey.CONSTANT_CODE_PREFIX_HOTTAG)
private
TourGoodMapper
tourGoodMapper
;
public
List
<
TourTag
>
getHotTag
()
{
// @Cache(key = RedisKey.CONSTANT_CODE_PREFIX_HOTTAG)
TourTag
tag
=
new
TourTag
();
public
List
<
TourTag
>
getHotTag
()
{
tag
.
setIsDel
(
0
);
tag
.
setIsHot
(
1
);
TourTag
tag
=
new
TourTag
();
return
mapper
.
findHotListTag
(
tag
);
tag
.
setIsDel
(
0
);
}
tag
.
setIsHot
(
1
);
return
mapper
.
findHotListTag
(
tag
);
public
List
<
TourTag
>
getTagList
(
Integer
isHot
)
{
}
TourTag
tag
=
new
TourTag
();
tag
.
setIsDel
(
0
);
public
List
<
TourTag
>
getHotTagAndGoods
()
{
if
(
isHot
!=
null
&&
isHot
==
1
){
TourTag
tag
=
new
TourTag
();
tag
.
setIsHot
(
1
);
tag
.
setIsDel
(
0
);
return
mapper
.
findHotListTag
(
tag
);
tag
.
setIsHot
(
1
);
}
List
<
TourTag
>
list
=
mapper
.
findHotListTag
(
tag
);
return
mapper
.
findAllByIsDel
(
tag
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
}
//增加两条线路例子
for
(
TourTag
tourTag
:
list
){
map
.
put
(
"tagId"
,
tourTag
.
getId
());
PageDataVO
<
TourGood
>
dataVO
=
PageDataVO
.
pageInfo
(
1
,
2
,
()
->
tourGoodMapper
.
getGoodList
(
map
));
public
PageDataVO
<
TourTag
>
findPage
(
Map
map
)
{
List
<
TourGood
>
pageDataVO
=
dataVO
.
getData
();
TourTag
tag
=
new
TourTag
();
tourTag
.
setList
(
pageDataVO
);
tag
.
setIsDel
(
0
);
}
return
PageDataVO
.
pageInfo
((
Integer
)
map
.
get
(
"page"
),(
Integer
)
map
.
get
(
"limit"
),()
->
mapper
.
findAllByIsDel
(
tag
));
return
list
;
}
}
@CacheClear
(
key
=
RedisKey
.
CONSTANT_CODE_PREFIX_HOTTAG
)
public
List
<
TourTag
>
getTagList
(
Integer
isHot
)
{
public
void
update
(
TourTag
banner
)
{
TourTag
tag
=
new
TourTag
();
this
.
updateSelectiveById
(
banner
);
tag
.
setIsDel
(
0
);
}
if
(
isHot
!=
null
&&
isHot
==
1
){
tag
.
setIsHot
(
1
);
return
mapper
.
findHotListTag
(
tag
);
@CacheClear
(
key
=
RedisKey
.
CONSTANT_CODE_PREFIX_HOTTAG
)
}
public
void
remove
(
int
id
)
{
return
mapper
.
findAllByIsDel
(
tag
);
this
.
deleteById
(
id
);
}
}
/**
public
PageDataVO
<
TourTag
>
findPage
(
Map
map
)
{
* 分页查询旅游标签
TourTag
tag
=
new
TourTag
();
* @param pageNo 查询的当前
tag
.
setIsDel
(
0
);
* @param pageSize 分页大小
return
PageDataVO
.
pageInfo
((
Integer
)
map
.
get
(
"page"
),(
Integer
)
map
.
get
(
"limit"
),()
->
mapper
.
findAllByIsDel
(
tag
));
* @return
}
*/
public
PageDataVO
<
TourTagAndBannerDTO
>
findTourTagWithPage
(
Integer
pageNo
,
Integer
pageSize
)
{
@CacheClear
(
key
=
RedisKey
.
CONSTANT_CODE_PREFIX_HOTTAG
)
PageDataVO
<
TourTagAndBannerDTO
>
tourTagAndBannerDTOPageDataVO
=
new
PageDataVO
<>();
public
void
update
(
TourTag
banner
)
{
//根据分页条件查询出旅游标签的信息
this
.
updateSelectiveById
(
banner
);
PageDataVO
<
TourTag
>
pageDataVO
=
PageDataVO
.
pageInfo
(
pageNo
,
pageSize
,
()
->
mapper
.
findAllByIsDel
(
TourTag
.
builder
().
isDel
(
0
).
build
()));
}
List
<
TourTag
>
tourTags
=
pageDataVO
.
getData
();
if
(
log
.
isDebugEnabled
()){
log
.
debug
(
"旅游分页查询标签:[{}]"
,
tourTags
);
@CacheClear
(
key
=
RedisKey
.
CONSTANT_CODE_PREFIX_HOTTAG
)
}
public
void
remove
(
int
id
)
{
if
(
CollectionUtils
.
isEmpty
(
tourTags
)){
this
.
deleteById
(
id
);
return
tourTagAndBannerDTOPageDataVO
;
}
}
List
<
TourTagAndBannerDTO
>
tourTagAndBannerDTOS
=
new
ArrayList
<>();
//根据标签ids查询banner
/**
List
<
Integer
>
tagIds
=
tourTags
.
stream
().
map
(
TourTag:
:
getId
).
collect
(
Collectors
.
toList
());
* 分页查询旅游标签
Map
<
Integer
,
List
<
TourTagBannerDTO
>>
tourTagBannerMap
=
tourTagBannerBiz
.
findTourTagBannersByTagIds
(
tagIds
);
* @param pageNo 查询的当前
tourTags
.
forEach
(
tourTag
->
{
* @param pageSize 分页大小
* @return
});
*/
for
(
TourTag
tourTag:
tourTags
){
public
PageDataVO
<
TourTagAndBannerDTO
>
findTourTagWithPage
(
Integer
pageNo
,
Integer
pageSize
)
{
//vo转换
PageDataVO
<
TourTagAndBannerDTO
>
tourTagAndBannerDTOPageDataVO
=
new
PageDataVO
<>();
TourTagDTO
tourTagDTO
=
new
TourTagDTO
();
//根据分页条件查询出旅游标签的信息
BeanUtils
.
copyProperties
(
tourTag
,
tourTagDTO
);
PageDataVO
<
TourTag
>
pageDataVO
=
PageDataVO
.
pageInfo
(
pageNo
,
pageSize
,
()
->
mapper
.
findAllByIsDel
(
TourTag
.
builder
().
isDel
(
0
).
build
()));
//根据旅游标签id查询出标签banner相关信息
List
<
TourTag
>
tourTags
=
pageDataVO
.
getData
();
List
<
TourTagBannerDTO
>
tagBannerDTOS
=
tourTagBannerMap
.
get
(
tourTag
.
getId
());
if
(
log
.
isDebugEnabled
()){
//banner 数量
log
.
debug
(
"旅游分页查询标签:[{}]"
,
tourTags
);
tourTagDTO
.
setBannerNums
(
tagBannerDTOS
==
null
?
0
:
tagBannerDTOS
.
size
());
}
tourTagAndBannerDTOS
.
add
(
TourTagAndBannerDTO
.
builder
().
tourTagDTO
(
tourTagDTO
).
tourTagBannerDTOS
(
tagBannerDTOS
).
build
());
if
(
CollectionUtils
.
isEmpty
(
tourTags
)){
}
return
tourTagAndBannerDTOPageDataVO
;
//组装数据
}
tourTagAndBannerDTOPageDataVO
.
setData
(
tourTagAndBannerDTOS
);
List
<
TourTagAndBannerDTO
>
tourTagAndBannerDTOS
=
new
ArrayList
<>();
tourTagAndBannerDTOPageDataVO
.
setPageNum
(
pageDataVO
.
getPageNum
());
//根据标签ids查询banner
tourTagAndBannerDTOPageDataVO
.
setPageSize
(
pageDataVO
.
getPageSize
());
List
<
Integer
>
tagIds
=
tourTags
.
stream
().
map
(
TourTag:
:
getId
).
collect
(
Collectors
.
toList
());
tourTagAndBannerDTOPageDataVO
.
setTotalCount
(
pageDataVO
.
getTotalCount
());
Map
<
Integer
,
List
<
TourTagBannerDTO
>>
tourTagBannerMap
=
tourTagBannerBiz
.
findTourTagBannersByTagIds
(
tagIds
);
tourTagAndBannerDTOPageDataVO
.
setTotalPage
(
pageDataVO
.
getTotalPage
());
tourTags
.
forEach
(
tourTag
->
{
return
tourTagAndBannerDTOPageDataVO
;
});
}
for
(
TourTag
tourTag:
tourTags
){
//vo转换
/**
TourTagDTO
tourTagDTO
=
new
TourTagDTO
();
* 根据主键id查询 旅游标签
BeanUtils
.
copyProperties
(
tourTag
,
tourTagDTO
);
* @param tagId
//根据旅游标签id查询出标签banner相关信息
* @return
List
<
TourTagBannerDTO
>
tagBannerDTOS
=
tourTagBannerMap
.
get
(
tourTag
.
getId
());
*/
//banner 数量
public
TourTagAndBannerDTO
findTourTagById
(
Integer
tagId
){
tourTagDTO
.
setBannerNums
(
tagBannerDTOS
==
null
?
0
:
tagBannerDTOS
.
size
());
TourTagAndBannerDTO
tourTagAndBannerDTO
=
new
TourTagAndBannerDTO
();
tourTagAndBannerDTOS
.
add
(
TourTagAndBannerDTO
.
builder
().
tourTagDTO
(
tourTagDTO
).
tourTagBannerDTOS
(
tagBannerDTOS
).
build
());
//根据旅游标签id查询出标签信息
}
TourTag
tourTag
=
mapper
.
findById
(
tagId
);
//组装数据
if
(
log
.
isDebugEnabled
()){
tourTagAndBannerDTOPageDataVO
.
setData
(
tourTagAndBannerDTOS
);
log
.
debug
(
"根据标签id=[{}]查询出标签信息:[{}]"
,
tagId
,
tourTag
);
tourTagAndBannerDTOPageDataVO
.
setPageNum
(
pageDataVO
.
getPageNum
());
}
tourTagAndBannerDTOPageDataVO
.
setPageSize
(
pageDataVO
.
getPageSize
());
if
(
tourTag
==
null
){
tourTagAndBannerDTOPageDataVO
.
setTotalCount
(
pageDataVO
.
getTotalCount
());
return
tourTagAndBannerDTO
;
tourTagAndBannerDTOPageDataVO
.
setTotalPage
(
pageDataVO
.
getTotalPage
());
}
TourTagDTO
tourTagDTO
=
new
TourTagDTO
();
return
tourTagAndBannerDTOPageDataVO
;
BeanUtils
.
copyProperties
(
tourTag
,
tourTagDTO
);
}
//根据旅游标签id查询出标签对应的轮播图信息
List
<
TourTagBannerDTO
>
tourTagBannerDTOS
=
tourTagBannerBiz
.
findTourTagBannersByTagId
(
tagId
);
/**
if
(
log
.
isDebugEnabled
()){
* 根据主键id查询 旅游标签
log
.
debug
(
"根据标签id=[{}],查询出轮播图信息:[{}]"
,
tagId
,
tourTagBannerDTOS
);
* @param tagId
}
* @return
*/
//组装数据
public
TourTagAndBannerDTO
findTourTagById
(
Integer
tagId
){
tourTagAndBannerDTO
.
setTourTagDTO
(
tourTagDTO
);
TourTagAndBannerDTO
tourTagAndBannerDTO
=
new
TourTagAndBannerDTO
();
tourTagAndBannerDTO
.
setTourTagBannerDTOS
(
tourTagBannerDTOS
);
//根据旅游标签id查询出标签信息
return
tourTagAndBannerDTO
;
TourTag
tourTag
=
mapper
.
findById
(
tagId
);
}
if
(
log
.
isDebugEnabled
()){
log
.
debug
(
"根据标签id=[{}]查询出标签信息:[{}]"
,
tagId
,
tourTag
);
/**
}
* 保存旅游标签
if
(
tourTag
==
null
){
* @param tourTagAndBannerDTO
return
tourTagAndBannerDTO
;
* @return
}
*/
TourTagDTO
tourTagDTO
=
new
TourTagDTO
();
@Transactional
(
rollbackFor
=
Exception
.
class
)
BeanUtils
.
copyProperties
(
tourTag
,
tourTagDTO
);
public
int
saveTourTag
(
TourTagAndBannerDTO
tourTagAndBannerDTO
,
UserDTO
userDTO
)
{
//根据旅游标签id查询出标签对应的轮播图信息
if
(
log
.
isDebugEnabled
()){
List
<
TourTagBannerDTO
>
tourTagBannerDTOS
=
tourTagBannerBiz
.
findTourTagBannersByTagId
(
tagId
);
log
.
debug
(
"传入保存的标签信息:[{}]"
,
tourTagAndBannerDTO
);
if
(
log
.
isDebugEnabled
()){
}
log
.
debug
(
"根据标签id=[{}],查询出轮播图信息:[{}]"
,
tagId
,
tourTagBannerDTOS
);
TourTagDTO
tourTagDTO
=
tourTagAndBannerDTO
.
getTourTagDTO
();
}
List
<
TourTagBannerDTO
>
tourTagBannerDTOS
=
tourTagAndBannerDTO
.
getTourTagBannerDTOS
();
//设置标签创建的相关信息
//组装数据
tourTagDTO
.
setCtrTime
(
Instant
.
now
().
toEpochMilli
());
tourTagAndBannerDTO
.
setTourTagDTO
(
tourTagDTO
);
tourTagDTO
.
setRank
(
tourTagDTO
.
getRank
()==
null
?
0
:
tourTagDTO
.
getRank
());
tourTagAndBannerDTO
.
setTourTagBannerDTOS
(
tourTagBannerDTOS
);
tourTagDTO
.
setIsHot
(
0
);
return
tourTagAndBannerDTO
;
//保存标签
}
int
effectRows
=
mapper
.
save
(
tourTagDTO
);
if
(
effectRows
==
0
){
/**
return
effectRows
;
* 保存旅游标签
}
* @param tourTagAndBannerDTO
if
(
CollectionUtils
.
isNotEmpty
(
tourTagBannerDTOS
))
{
* @return
//保存标签轮播图
*/
tourTagBannerDTOS
.
stream
().
peek
(
tourTagBannerDTO
->
tourTagBannerDTO
.
setTagId
(
tourTagDTO
.
getId
())).
count
();
@Transactional
(
rollbackFor
=
Exception
.
class
)
tourTagBannerBiz
.
saveBatch
(
tourTagBannerDTOS
,
userDTO
);
public
int
saveTourTag
(
TourTagAndBannerDTO
tourTagAndBannerDTO
,
UserDTO
userDTO
)
{
}
if
(
log
.
isDebugEnabled
()){
return
effectRows
;
log
.
debug
(
"传入保存的标签信息:[{}]"
,
tourTagAndBannerDTO
);
}
}
TourTagDTO
tourTagDTO
=
tourTagAndBannerDTO
.
getTourTagDTO
();
/**
List
<
TourTagBannerDTO
>
tourTagBannerDTOS
=
tourTagAndBannerDTO
.
getTourTagBannerDTOS
();
* 根据主键修改标签状态
//设置标签创建的相关信息
* @param id
tourTagDTO
.
setCtrTime
(
Instant
.
now
().
toEpochMilli
());
* @param status
tourTagDTO
.
setRank
(
tourTagDTO
.
getRank
()==
null
?
0
:
tourTagDTO
.
getRank
());
* @return
tourTagDTO
.
setIsHot
(
0
);
*/
//保存标签
@Transactional
(
rollbackFor
=
Exception
.
class
)
int
effectRows
=
mapper
.
save
(
tourTagDTO
);
public
int
updateTourTagStateById
(
Integer
id
,
int
status
)
{
if
(
effectRows
==
0
){
//更改标签状态
return
effectRows
;
int
effecttagRows
=
mapper
.
updateTourTagStatusById
(
id
,
status
);
}
if
(
effecttagRows
==
0
){
if
(
CollectionUtils
.
isNotEmpty
(
tourTagBannerDTOS
))
{
return
effecttagRows
;
//保存标签轮播图
}
tourTagBannerDTOS
.
stream
().
peek
(
tourTagBannerDTO
->
tourTagBannerDTO
.
setTagId
(
tourTagDTO
.
getId
())).
count
();
//更改标签对应的轮播图状态
tourTagBannerBiz
.
saveBatch
(
tourTagBannerDTOS
,
userDTO
);
tourTagBannerBiz
.
updateTourTagBannerStatusByTagId
(
id
,
status
);
}
return
effecttagRows
;
return
effectRows
;
}
}
/**
/**
*更改旅游标签信息
* 根据主键修改标签状态
* @param tourTagAndBannerDTO
* @param id
* @return
* @param status
*/
* @return
@Transactional
(
rollbackFor
=
Exception
.
class
)
*/
public
int
updateTourTag
(
TourTagAndBannerDTO
tourTagAndBannerDTO
,
UserDTO
userDTO
)
{
@Transactional
(
rollbackFor
=
Exception
.
class
)
if
(
log
.
isDebugEnabled
()){
public
int
updateTourTagStateById
(
Integer
id
,
int
status
)
{
log
.
debug
(
"更改的旅游标签信息:[{}]"
,
tourTagAndBannerDTO
);
//更改标签状态
}
int
effecttagRows
=
mapper
.
updateTourTagStatusById
(
id
,
status
);
TourTagDTO
tourTagDTO
=
tourTagAndBannerDTO
.
getTourTagDTO
();
if
(
effecttagRows
==
0
){
//修改旅游标签信息
return
effecttagRows
;
tourTagDTO
.
setUpdTime
(
Instant
.
now
().
toEpochMilli
());
}
int
effrows
=
mapper
.
updateTourTag
(
tourTagDTO
);
//更改标签对应的轮播图状态
if
(
effrows
==
0
){
tourTagBannerBiz
.
updateTourTagBannerStatusByTagId
(
id
,
status
);
return
effrows
;
return
effecttagRows
;
}
}
//修改标签的相关轮播图
List
<
TourTagBannerDTO
>
tourTagBannerDTOS
=
tourTagAndBannerDTO
.
getTourTagBannerDTOS
();
/**
if
(
log
.
isDebugEnabled
()){
*更改旅游标签信息
log
.
debug
(
"更改标签对应的轮播图信息:[{}]"
,
tourTagBannerDTOS
);
* @param tourTagAndBannerDTO
}
* @return
if
(
CollectionUtils
.
isNotEmpty
(
tourTagBannerDTOS
)){
*/
tourTagBannerDTOS
.
stream
().
filter
(
tourTagBannerDTO
->
Objects
.
isNull
(
tourTagBannerDTO
.
getTagId
())).
peek
(
tourTagBannerDTO
->
tourTagBannerDTO
.
setTagId
(
tourTagDTO
.
getId
())).
count
();
@Transactional
(
rollbackFor
=
Exception
.
class
)
}
public
int
updateTourTag
(
TourTagAndBannerDTO
tourTagAndBannerDTO
,
UserDTO
userDTO
)
{
tourTagBannerBiz
.
updateTourBannerByBatch
(
tourTagBannerDTOS
,
tourTagAndBannerDTO
.
getTourTagDTO
().
getId
(),
userDTO
);
if
(
log
.
isDebugEnabled
()){
return
effrows
;
log
.
debug
(
"更改的旅游标签信息:[{}]"
,
tourTagAndBannerDTO
);
}
}
TourTagDTO
tourTagDTO
=
tourTagAndBannerDTO
.
getTourTagDTO
();
/**
//修改旅游标签信息
* 更改旅游标签热度状态
tourTagDTO
.
setUpdTime
(
Instant
.
now
().
toEpochMilli
());
* @param id
int
effrows
=
mapper
.
updateTourTag
(
tourTagDTO
);
* @param state
if
(
effrows
==
0
){
* @return
return
effrows
;
*/
}
public
int
updateTourTagHotSate
(
Integer
id
,
Integer
state
)
{
//修改标签的相关轮播图
return
mapper
.
updateTourTagHotSate
(
id
,
state
);
List
<
TourTagBannerDTO
>
tourTagBannerDTOS
=
tourTagAndBannerDTO
.
getTourTagBannerDTOS
();
}
if
(
log
.
isDebugEnabled
()){
log
.
debug
(
"更改标签对应的轮播图信息:[{}]"
,
tourTagBannerDTOS
);
/**
}
* 根据标签名查询是否存在
if
(
CollectionUtils
.
isNotEmpty
(
tourTagBannerDTOS
)){
* @param name
tourTagBannerDTOS
.
stream
().
filter
(
tourTagBannerDTO
->
Objects
.
isNull
(
tourTagBannerDTO
.
getTagId
())).
peek
(
tourTagBannerDTO
->
tourTagBannerDTO
.
setTagId
(
tourTagDTO
.
getId
())).
count
();
* @return
}
*/
tourTagBannerBiz
.
updateTourBannerByBatch
(
tourTagBannerDTOS
,
tourTagAndBannerDTO
.
getTourTagDTO
().
getId
(),
userDTO
);
public
boolean
checkTagNameExist
(
String
name
,
Integer
id
)
{
return
effrows
;
List
<
TourTag
>
tourTags
=
mapper
.
findByTagName
(
name
,
id
);
}
return
CollectionUtils
.
isNotEmpty
(
tourTags
);
}
/**
* 更改旅游标签热度状态
/**
* @param id
* 根据旅游标签状态查询
* @param state
* @param status
* @return
* @return
*/
*/
public
int
updateTourTagHotSate
(
Integer
id
,
Integer
state
)
{
public
List
<
TourTag
>
findTourTagNameAndIdsByStatus
(
Integer
status
){
return
mapper
.
updateTourTagHotSate
(
id
,
state
);
return
mapper
.
selectByStuatus
(
status
);
}
}
/**
* 根据标签名查询是否存在
* @param name
* @return
*/
public
boolean
checkTagNameExist
(
String
name
,
Integer
id
)
{
List
<
TourTag
>
tourTags
=
mapper
.
findByTagName
(
name
,
id
);
return
CollectionUtils
.
isNotEmpty
(
tourTags
);
}
/**
* 根据旅游标签状态查询
* @param status
* @return
*/
public
List
<
TourTag
>
findTourTagNameAndIdsByStatus
(
Integer
status
){
return
mapper
.
selectByStuatus
(
status
);
}
}
}
\ No newline at end of file
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourTagController.java
View file @
0c22774d
package
com
.
xxfc
.
platform
.
tour
.
rest
;
package
com
.
xxfc
.
platform
.
tour
.
rest
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
com.xxfc.platform.tour.biz.TourTagBiz
;
import
com.xxfc.platform.tour.biz.TourTagBiz
;
import
com.xxfc.platform.tour.entity.TourTag
;
import
com.xxfc.platform.tour.entity.TourTag
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
@RestController
@RestController
@RequestMapping
(
"tourTag"
)
@RequestMapping
(
"tourTag"
)
public
class
TourTagController
extends
BaseController
<
TourTagBiz
,
TourTag
>
{
public
class
TourTagController
extends
BaseController
<
TourTagBiz
,
TourTag
>
{
@Autowired
@Autowired
private
TourTagBiz
tagBiz
;
private
TourTagBiz
tagBiz
;
@GetMapping
(
"/app/unauth/getTagList"
)
@GetMapping
(
"/app/unauth/getTagList"
)
public
ObjectRestResponse
getTagList
(
pageDTO
dto
){
public
ObjectRestResponse
getTagList
(
pageDTO
dto
){
if
(
dto
==
null
)
{
if
(
dto
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
return
ObjectRestResponse
.
createDefaultFail
();
}
}
Integer
hot
=
dto
.
getHot
();
Integer
hot
=
dto
.
getHot
();
if
(
hot
==
1
){
if
(
hot
==
1
){
List
<
TourTag
>
hotTag
=
tagBiz
.
getHotTag
();
List
<
TourTag
>
hotTag
=
tagBiz
.
getHotTag
();
return
ObjectRestResponse
.
succ
(
hotTag
);
return
ObjectRestResponse
.
succ
(
hotTag
);
}
}
PageDataVO
<
TourTag
>
all
=
tagBiz
.
findPage
(
BeanUtil
.
beanToMap
(
dto
));
PageDataVO
<
TourTag
>
all
=
tagBiz
.
findPage
(
BeanUtil
.
beanToMap
(
dto
));
return
ObjectRestResponse
.
succ
(
all
);
return
ObjectRestResponse
.
succ
(
all
);
}
}
/**
@Override
* 标签带两条线路
@ApiOperation
(
"修改"
)
* @param dto
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
PUT
)
* @return
public
ObjectRestResponse
<
TourTag
>
update
(
@RequestBody
TourTag
tag
){
*/
tagBiz
.
update
(
tag
);
@GetMapping
(
"/app/unauth/getTagListAndGoods"
)
return
new
ObjectRestResponse
<
TourTag
>();
public
ObjectRestResponse
getTagListAndGoods
(
pageDTO
dto
){
}
if
(
dto
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
@Override
@ApiOperation
(
"删除"
)
Integer
hot
=
dto
.
getHot
();
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
public
ObjectRestResponse
<
TourTag
>
remove
(
@PathVariable
int
id
){
if
(
hot
==
1
){
tagBiz
.
remove
(
id
);
List
<
TourTag
>
hotTag
=
tagBiz
.
getHotTagAndGoods
();
return
new
ObjectRestResponse
<
TourTag
>();
return
ObjectRestResponse
.
succ
(
hotTag
);
}
}
PageDataVO
<
TourTag
>
all
=
tagBiz
.
findPage
(
BeanUtil
.
beanToMap
(
dto
));
@Data
return
ObjectRestResponse
.
succ
(
all
);
public
class
pageDTO
extends
PageParam
{
@ApiModelProperty
(
"是否热门"
)
}
Integer
hot
;
}
@Override
@ApiOperation
(
"修改"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
PUT
)
@GetMapping
(
"/token"
)
public
ObjectRestResponse
<
TourTag
>
update
(
@RequestBody
TourTag
tag
){
public
ObjectRestResponse
apptoken
(
AppUserDTO
appUserDTO
){
tagBiz
.
update
(
tag
);
return
new
ObjectRestResponse
<
TourTag
>();
return
ObjectRestResponse
.
succ
(
appUserDTO
);
}
}
@Override
@ApiOperation
(
"删除"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
public
ObjectRestResponse
<
TourTag
>
remove
(
@PathVariable
int
id
){
tagBiz
.
remove
(
id
);
return
new
ObjectRestResponse
<
TourTag
>();
}
@Data
public
class
pageDTO
extends
PageParam
{
@ApiModelProperty
(
"是否热门"
)
Integer
hot
;
}
@GetMapping
(
"/token"
)
public
ObjectRestResponse
apptoken
(
AppUserDTO
appUserDTO
){
return
ObjectRestResponse
.
succ
(
appUserDTO
);
}
}
}
\ 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