Commit 2c0e0fab authored by libin's avatar libin

旅游标签

parent 483516af
...@@ -26,6 +26,16 @@ ...@@ -26,6 +26,16 @@
<mapper.version>3.4.0</mapper.version> <mapper.version>3.4.0</mapper.version>
</properties> </properties>
<dependencies> <dependencies>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>-->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
...@@ -65,11 +75,11 @@ ...@@ -65,11 +75,11 @@
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.1.37</version> <version>1.1.37</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.jsonwebtoken</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId> <artifactId>jjwt</artifactId>
......
package com.xxfc.platform.tour.biz; package com.xxfc.platform.tour.biz;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO; import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.util.EntityUtils; import com.github.wxiaoqi.security.common.util.EntityUtils;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
...@@ -16,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -16,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 标签轮播图 * 标签轮播图
...@@ -28,6 +28,8 @@ import java.util.List; ...@@ -28,6 +28,8 @@ import java.util.List;
public class TourTagBannerBiz extends BaseBiz<TourTagBannerMapper,TourTagBanner> { public class TourTagBannerBiz extends BaseBiz<TourTagBannerMapper,TourTagBanner> {
private List<TourTagBannerDTO> tourTagBannerDTOS;
public List<TourTagBanner> findById(long tid) { public List<TourTagBanner> findById(long tid) {
TourTagBanner tourTagBanner = new TourTagBanner(); TourTagBanner tourTagBanner = new TourTagBanner();
...@@ -108,10 +110,13 @@ public class TourTagBannerBiz extends BaseBiz<TourTagBannerMapper,TourTagBanner> ...@@ -108,10 +110,13 @@ public class TourTagBannerBiz extends BaseBiz<TourTagBannerMapper,TourTagBanner>
* @param tourTagBannerDTOS * @param tourTagBannerDTOS
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateTourBannerByBatch(List<TourTagBannerDTO> tourTagBannerDTOS, UserDTO userDTO) { public void updateTourBannerByBatch(List<TourTagBannerDTO> tourTagBannerDTOS,UserDTO userDTO) {
tourTagBannerDTOS.stream().peek(tourTagBannerDTO -> EntityUtils.setUpdatedInfo(tourTagBannerDTO)).forEach(tourTagBannerDTO -> { tourTagBannerDTOS.stream().filter(tourTagBannerDTO -> Objects.nonNull(tourTagBannerDTO.getId())).peek(tourTagBannerDTO -> EntityUtils.setUpdatedInfo(tourTagBannerDTO)).forEach(tourTagBannerDTO -> {
updateTourBanner(tourTagBannerDTO,userDTO); updateTourBanner(tourTagBannerDTO,userDTO);
}); });
tourTagBannerDTOS.stream().filter(tourTagBannerDTO -> Objects.isNull(tourTagBannerDTO.getId())).peek(tourTagBannerDTO -> {
save(tourTagBannerDTO,userDTO);
}).count();
} }
/** /**
......
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.AppUserDTO;
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;
...@@ -9,6 +8,7 @@ import com.xxfc.platform.tour.dto.TourTagAndBannerDTO; ...@@ -9,6 +8,7 @@ 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.mapper.TourTagMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -21,6 +21,7 @@ import java.time.Instant; ...@@ -21,6 +21,7 @@ import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
* 旅游路线标签 * 旅游路线标签
...@@ -130,7 +131,9 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> { ...@@ -130,7 +131,9 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
tourTagDTO.setIsDel(0); tourTagDTO.setIsDel(0);
tourTagDTO.setRank(tourTagDTO.getRank()==null?0:tourTagDTO.getRank()); tourTagDTO.setRank(tourTagDTO.getRank()==null?0:tourTagDTO.getRank());
//保存标签 //保存标签
int effectRows = mapper.save(tourTagDTO); TourTag tag = new TourTag();
BeanUtils.copyProperties(tourTagDTO,tag);
int effectRows = mapper.insertSelective(tag);
if (effectRows==0){ if (effectRows==0){
return effectRows; return effectRows;
} }
...@@ -176,7 +179,18 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> { ...@@ -176,7 +179,18 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
} }
//修改标签的相关轮播图 //修改标签的相关轮播图
List<TourTagBannerDTO> tourTagBannerDTOS = tourTagAndBannerDTO.getTourTagBannerDTOS(); List<TourTagBannerDTO> tourTagBannerDTOS = tourTagAndBannerDTO.getTourTagBannerDTOS();
tourTagBannerDTOS.stream().filter(tourTagBannerDTO -> Objects.isNull(tourTagBannerDTO.getTagId())).peek(tourTagBannerDTO -> tourTagBannerDTO.setTagId(tourTagDTO.getId())).count();
tourTagBannerBiz.updateTourBannerByBatch(tourTagBannerDTOS,userDTO); tourTagBannerBiz.updateTourBannerByBatch(tourTagBannerDTOS,userDTO);
return effrows; return effrows;
} }
/**
* 更改旅游标签热度状态
* @param id
* @param state
* @return
*/
public int updateTourTagHotSate(Integer id, Integer state) {
return mapper.updateTourTagHotSate(id,state);
}
} }
\ No newline at end of file
...@@ -52,4 +52,7 @@ public interface TourTagMapper extends Mapper<TourTag> { ...@@ -52,4 +52,7 @@ public interface TourTagMapper extends Mapper<TourTag> {
@Update("update tour_tag set `name`=#{name},`img`=#{img},`describe`=#{describe},`link`=#{link}" + @Update("update tour_tag set `name`=#{name},`img`=#{img},`describe`=#{describe},`link`=#{link}" +
",`rank`=#{rank},`upd_time`=#{updTime} where `id`=#{id}") ",`rank`=#{rank},`upd_time`=#{updTime} where `id`=#{id}")
int updateTourTag(TourTagDTO tourTagDTO); int updateTourTag(TourTagDTO tourTagDTO);
@Update("update tour_tag set `is_hot`=#{state} where `id`=#{id}")
int updateTourTagHotSate(@Param("id") Integer id, @Param("state") Integer state);
} }
...@@ -7,6 +7,7 @@ import com.xxfc.platform.tour.common.TourBaseController; ...@@ -7,6 +7,7 @@ import com.xxfc.platform.tour.common.TourBaseController;
import com.xxfc.platform.tour.dto.TourTagAndBannerDTO; import com.xxfc.platform.tour.dto.TourTagAndBannerDTO;
import com.xxfc.platform.tour.entity.TourTag; import com.xxfc.platform.tour.entity.TourTag;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.apache.commons.collections4.Put;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -95,4 +96,22 @@ public class TourTagAdminController extends TourBaseController<TourTagBiz> { ...@@ -95,4 +96,22 @@ public class TourTagAdminController extends TourBaseController<TourTagBiz> {
} }
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
/**
* 修改旅游标签热度状态
* @param id
* @param state
* @return
*/
@ApiOperation("更新旅游标签热度状态")
@PutMapping("/update/hot")
public ObjectRestResponse updateHotStatus(@RequestParam("id") Integer id,@RequestParam("state") Integer state){
int effectRows = getBaseBiz().updateTourTagHotSate(id,state);
if (effectRows>0){
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail();
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment