Commit 18202b08 authored by hanfeng's avatar hanfeng

Merge branch 'base-modify' of http://10.5.52.3/youjj/cloud-platform into base-modify

parents e9e206cc fb4b402e
package com.github.wxiaoqi.security.common.vo;
import lombok.Data;
/**
* 首页商品列表
*/
@Data
public class GoodDataVO{
private Integer id;
private String name;
private String imgUrl;
private String name1;
private String price;
}
...@@ -3,11 +3,11 @@ package com.github.wxiaoqi.security.api.vo.config; ...@@ -3,11 +3,11 @@ package com.github.wxiaoqi.security.api.vo.config;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import feign.RequestTemplate; import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration; import java.util.Enumeration;
...@@ -18,6 +18,7 @@ import java.util.Enumeration; ...@@ -18,6 +18,7 @@ import java.util.Enumeration;
* @data 2019/6/25 16:22 * @data 2019/6/25 16:22
*/ */
@Configuration @Configuration
@Component
public class HeaderConfig implements RequestInterceptor { public class HeaderConfig implements RequestInterceptor {
@Override @Override
......
...@@ -11,4 +11,17 @@ ...@@ -11,4 +11,17 @@
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
<artifactId>xx-app-api</artifactId> <artifactId>xx-app-api</artifactId>
<dependencies>
<dependency>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-campsite-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-tour-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project> </project>
\ No newline at end of file
package com.xxfc.platform.app.constant;
public class RedisKey {
/**
*旅游标签的前缀
*/
public static final String CONSTANT_CODE_PREFIX ="cache:Tag:";
/**
*旅游标签的key
*/
public static final String CONSTANT_CODE_PREFIX_HOTTAG =CONSTANT_CODE_PREFIX+"hotTag";
/**
*首页banner的key
*/
public static final String CONSTANT_CODE_PREFIX_BANNER ="cache:banner:";
}
package com.xxfc.platform.app.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* @author libin
* @version 1.0
* @description banner 设置
* @data 2019/6/26 9:20
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Banner {
private static final long serialVersionUID = 1L;
/**
* 首页banner图主键
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("首页banner图主键")
private Long id;
/**
* 标题
*/
@Column(name = "title")
@ApiModelProperty(value = "标题")
private String title;
/**
* 封面
*/
@Column(name = "cover")
@ApiModelProperty(value = "封面")
private String cover;
/**
* 创建人
*/
@Column(name = "crt_name")
@ApiModelProperty(value = "创建人")
private String crtName;
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
/**
* 更新人
*/
@Column(name = "upd_name")
@ApiModelProperty(value = "更新人")
private String updName;
/**
* 修改时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "修改时间", hidden = true )
private Long updTime;
/**
* 跳转链接
*/
@Column(name = "url")
@ApiModelProperty(value = "跳转链接")
private String url;
/**
* 是否删除,0否,1是
*/
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除,0否,1是")
private Integer isDel;
/**
* 排序
*/
@Column(name = "rank")
@ApiModelProperty(value = "排序")
private Integer rank;
/**
*'类型:0-app首页,1-app旅游页;2-租车' 3-营地,
*/
@Column(name = "type")
@ApiModelProperty(value = "banner类型")
private Integer type;
}
...@@ -18,6 +18,12 @@ ...@@ -18,6 +18,12 @@
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.github.wxiaoqi</groupId>
<artifactId>ace-admin-api</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -16,7 +16,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -16,7 +16,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableScheduling @EnableScheduling
@EnableAceAuthClient @EnableAceAuthClient
@EnableFeignClients(value = {"com.github.wxiaoqi.security.auth.client.feign", "com.xxfc.platform.app.feign"},defaultConfiguration = HeaderConfig.class) @EnableFeignClients(value = {"com.github.wxiaoqi.security", "com.xxfc.platform"},defaultConfiguration = HeaderConfig.class)
@EnableAceCache @EnableAceCache
@tk.mybatis.spring.annotation.MapperScan(basePackages = "com.xxfc.platform.app.mapper") @tk.mybatis.spring.annotation.MapperScan(basePackages = "com.xxfc.platform.app.mapper")
public class AppApplication { public class AppApplication {
......
package com.xxfc.platform.app.biz;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.entity.Banner;
import com.xxfc.platform.app.mapper.BannerMapper;
import org.springframework.stereotype.Service;
import java.time.Instant;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description TODO
* @data 2019/6/26 9:24
*/
@Service
public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
/* @CacheClear(key = RedisKey.CONSTANT_CODE_PREFIX_BANNER)
public void update(Banner banner) {
this.updateSelectiveById(banner);
}
@CacheClear(key = RedisKey.CONSTANT_CODE_PREFIX_BANNER)
public void remove(int id) {
this.deleteById(id);
}*/
public List<Banner> findBannerList(Integer type) {
Banner banner = new Banner();
banner.setIsDel(0);
banner.setType(type);
return mapper.selectByExample(banner);
}
/*
*/
/**
* 更改banner信息
* @param banner
* @param userInfo
* @return
*//*
public int update(Banner banner, UserDTO userInfo) {
banner.setUpdName(userInfo.getUsername());
banner.setUpdTime(Instant.now().toEpochMilli());
return mapper.updateByPrimaryKeySelective(banner);
}
*/
/**
* 分页查询banner
* @param pageNo
* @param pageSize
* @return
*/
public PageDataVO<Banner> findBannePage(Integer pageNo, Integer pageSize) {
return PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.findBannerListByisDelOrderByRank(Banner.builder().isDel(0).build()));
}
/**
* 保存或更新banner
* @param banner
* @param userInfo
* @return
*/
public int save(Banner banner, UserDTO userInfo) {
if (banner.getId()!=null){
banner.setUpdName(userInfo.getUsername());
banner.setUpdTime(Instant.now().toEpochMilli());
return mapper.updateByPrimaryKeySelective(banner);
}else {
banner.setCrtName(userInfo.getUsername());
banner.setCrtTime(Instant.now().toEpochMilli());
banner.setIsDel(0);
banner.setRank(banner.getRank()==null?0:banner.getRank());
return mapper.insertSelective(banner);
}
}
/**
* 逻辑删除
* @param id
* @param status
* @param userInfo
* @return
*/
public int updateBannerStatus(Integer id, int status, UserDTO userInfo) {
return mapper.updateByPrimaryKeySelective(Banner.builder().id(Long.valueOf(id)).isDel(status).updName(userInfo.getUsername()).updTime(Instant.now().toEpochMilli()).build());
}
}
package com.xxfc.platform.app.mapper;
import com.xxfc.platform.app.entity.Banner;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* 首页banner图
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Repository
public interface BannerMapper extends Mapper<Banner> {
@Select("select * from `banner` where is_del=#{isDel} order by rank ASC")
List<Banner> findBannerListByisDelOrderByRank(Banner banner);
}
package com.xxfc.platform.app.rest;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.xxfc.platform.app.biz.CofigBiz;
import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.campsite.feign.CampsiteFeign;
import com.xxfc.platform.tour.feign.TourFeign;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("home")
@IgnoreClientToken
@Slf4j
public class AppHomeController extends BaseController<CofigBiz,Cofig> {
@Autowired
CampsiteFeign campsiteFeign;
@Autowired
TourFeign tourFeign;
@RequestMapping(value ="/app/unauth/goodList",method = RequestMethod.GET)
@IgnoreUserToken
public ObjectRestResponse<List<GoodDataVO>> goodList(
@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit",defaultValue = "4") Integer limit,
@RequestParam(value = "type",defaultValue = "1") Integer type
){
List<GoodDataVO> list=new ArrayList<>();
if (type==2){
list=tourFeign.goodList(page,limit);
}else if (type==3){
list=campsiteFeign.goodList(page,limit);
}
return new ObjectRestResponse<>().rel(true).data(list);
}
}
\ No newline at end of file
package com.xxfc.platform.app.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.app.biz.BannerBiz;
import com.xxfc.platform.app.entity.Banner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description TODO
* @data 2019/6/26 10:29
*/
@RestController
@RequestMapping("/banner")
public class BannerController {
@Autowired
private BannerBiz bannerBiz;
/**
*查询banner图
* @return
*/
@GetMapping("/app/unauth/findBannerlist")
public ObjectRestResponse findBannerlist(@RequestParam("type") Integer type){
if (type==null) {
return ObjectRestResponse.createDefaultFail();
}
List<Banner> bannerList = bannerBiz.findBannerList(type);
return ObjectRestResponse.succ(bannerList);
}
}
package com.xxfc.platform.app.rest.admin;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.biz.BannerBiz;
import com.xxfc.platform.app.entity.Banner;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author libin
* @version 1.0
* @description banner 图
* @data 2019/6/12 21:15
*/
@RestController
@RequestMapping("/admin/banner")
@Api(value = "banner后台接口",tags = "banner后台接口")
public class BannerAdminController {
@Autowired
private BannerBiz bannerBiz;
/**
* 修改
* @param banner
* @return
*/
@PutMapping
@ApiOperation(value = "banner修改",notes = "修改")
public ObjectRestResponse<Banner> update(@RequestBody Banner banner, UserDTO userInfo){
int effectRows = bannerBiz.save(banner,userInfo);
if (effectRows>0){
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail();
}
/**
* 根据id查询banner
* @param id
* @return
*/
@GetMapping("/{id}")
@ApiOperation(value = "根据id查询banner图",notes = "根据id查询banner图")
public ObjectRestResponse<Banner> findBannerById(@PathVariable Integer id){
Banner Banner = bannerBiz.selectById(id);
return ObjectRestResponse.succ(Banner);
}
/**
* 分页查询banner
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/page")
@ApiOperation(value = "banner分页查询",notes = "banner分页查询")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "pageNo",paramType = "query",required = false,dataType = "integer",defaultValue = "0"),
@ApiImplicitParam(name = "pageSize",paramType = "query",required = false,dataType = "integer",defaultValue = "10")
})
public ObjectRestResponse<PageDataVO> findBannerPage(@RequestParam(name = "pageNo",defaultValue = "0",required = false) Integer pageNo,
@RequestParam(name = "pageSize",defaultValue = "10",required = false) Integer pageSize){
PageDataVO<Banner> pageDataVO = bannerBiz.findBannePage(pageNo,pageSize);
return ObjectRestResponse.succ(pageDataVO);
}
/**
* 保存banner
* @param banner
* @return
*/
@ApiOperation(value = "banner保存",notes = "banner保存")
@PostMapping
public ObjectRestResponse<Void> saveBanner(@RequestBody Banner banner,UserDTO userDTO){
banner.setIsDel(0);
int effectRows = bannerBiz.save(banner,userDTO);
if (effectRows>0){
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail();
}
/**
* 逻辑删除
* @param id
* @return
*/
@DeleteMapping("/{id}")
@ApiOperation(value = "banner逻辑删除",notes = "banner逻辑删除")
public ObjectRestResponse<Void> deleteBannerById(@PathVariable Integer id,UserDTO userDTO){
int effectRows = bannerBiz.updateBannerStatus(id,1,userDTO);
if (effectRows>0){
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail();
}
/**
* 真实删除
* @param id
* @return
*/
@DeleteMapping("/del/{id}")
public ObjectRestResponse<Void> deleteReallyBannerById(@PathVariable(value = "id") Integer id){
bannerBiz.deleteById(id);
return ObjectRestResponse.succ();
}
}
\ No newline at end of file
<?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.xxfc.platform.tour.mapper.TourBannerMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.app.entity.Banner" id="bannerMap">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="cover" column="cover"/>
<result property="crtName" column="crt_name"/>
<result property="crtTime" column="crt_time"/>
<result property="updName" column="upd_name"/>
<result property="updTime" column="upd_time"/>
<result property="url" column="url"/>
<result property="isDel" column="is_del"/>
</resultMap>
</mapper>
\ No newline at end of file
package com.xxfc.platform.campsite.feign;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* Created by ace on 2017/9/15.
*/
//@FeignClient(value = "${auth.serviceId}",configuration = {})
@FeignClient("xx-campsite")
public interface CampsiteFeign {
@ApiOperation("首页营地列表")
@GetMapping(value = "/campsiteShop/app/shopList")
public List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit",defaultValue = "4") Integer limit);
}
...@@ -2,6 +2,7 @@ package com.xxfc.platform.campsite.biz; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.campsite.biz;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.campsite.dto.*; import com.xxfc.platform.campsite.dto.*;
import com.xxfc.platform.campsite.vo.*; import com.xxfc.platform.campsite.vo.*;
...@@ -342,6 +343,16 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper,CampsiteShop> { ...@@ -342,6 +343,16 @@ public class CampsiteShopBiz extends BaseBiz<CampsiteShopMapper,CampsiteShop> {
return s; return s;
} }
/**
* 首页营地列表
* @param page
* @param limit
* @return
*/
public List<GoodDataVO> getAllByHome(Integer page, Integer limit){
return mapper.findAllByHome((page-1)*limit,limit);
};
} }
\ No newline at end of file
package com.xxfc.platform.campsite.mapper; package com.xxfc.platform.campsite.mapper;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.xxfc.platform.campsite.dto.CampsiteShopAdminFindDTO; import com.xxfc.platform.campsite.dto.CampsiteShopAdminFindDTO;
import com.xxfc.platform.campsite.dto.CampsiteShopAdminPageDTO; import com.xxfc.platform.campsite.dto.CampsiteShopAdminPageDTO;
import com.xxfc.platform.campsite.dto.CampsiteShopDetailDTO; import com.xxfc.platform.campsite.dto.CampsiteShopDetailDTO;
...@@ -26,6 +27,14 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> { ...@@ -26,6 +27,14 @@ public interface CampsiteShopMapper extends Mapper<CampsiteShop> {
*/ */
List<CampsiteShopPageDTO> findAllCampsiteShopsByType(@Param("typeId") Integer typeId); List<CampsiteShopPageDTO> findAllCampsiteShopsByType(@Param("typeId") Integer typeId);
/**
* 首页营地列表
* @param start
* @param size
* @return
*/
List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size);
/** /**
* 根据店铺id查询 * 根据店铺id查询
* @param id * @param id
......
...@@ -3,6 +3,7 @@ package com.xxfc.platform.campsite.rest; ...@@ -3,6 +3,7 @@ package com.xxfc.platform.campsite.rest;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
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.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.sun.org.apache.regexp.internal.RE; import com.sun.org.apache.regexp.internal.RE;
import com.xxfc.platform.campsite.biz.CampsiteShopBiz; import com.xxfc.platform.campsite.biz.CampsiteShopBiz;
...@@ -15,6 +16,8 @@ import io.swagger.annotations.ApiOperation; ...@@ -15,6 +16,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
...@@ -51,5 +54,12 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp ...@@ -51,5 +54,12 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
return ObjectRestResponse.succ(campsiteShopDetailVo); return ObjectRestResponse.succ(campsiteShopDetailVo);
} }
@ApiOperation("首页营地列表")
@GetMapping(value = "/app/shopList")
public List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit",defaultValue = "4") Integer limit) {
return getBaseBiz().getAllByHome(page,limit);
}
} }
\ No newline at end of file
...@@ -47,6 +47,15 @@ ...@@ -47,6 +47,15 @@
</if> </if>
</select> </select>
<!--首页查询全部-->
<select id="findAllByHome" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
select cs.id as `id`,cs.name as `name`,cs.logo as `imgUrl`,cs.province_name as `name1`
FROM `campsite_shop` cs
where cs.sale_state=1
order by cs.hot desc
limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
</select>
<!--根据id查询详情--> <!--根据id查询详情-->
<select id="findCampsiteShopDetailById" resultType="com.xxfc.platform.campsite.dto.CampsiteShopDetailDTO"> <select id="findCampsiteShopDetailById" resultType="com.xxfc.platform.campsite.dto.CampsiteShopDetailDTO">
select `name` as `name`,`province_name` as `provinceName`,`city_name` as `cityName`,`address` as `address`, select `name` as `name`,`province_name` as `provinceName`,`city_name` as `cityName`,`address` as `address`,
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<modules> <modules>
<module>xx-common-platform</module> <module>xx-common-platform</module>
<module>xx-common-platform-web</module> <module>xx-common-platform-web</module>
<module>xx-common-platform-component</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>xx-common</artifactId>
<groupId>com.xxfc</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-common-platform-component</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.xxfc.platform.common.annotaion;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author libin
* @version 1.0
* @description 复杂类型校验
* @data 2019/6/13 13:42
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface BeanValid {
Class<?>[] value() default {};
}
package com.xxfc.platform.common.annotaion;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author libin
* @version 1.0
* @description 简单参数类型校验
* @data 2019/6/13 13:42
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface SimpleValid {
}
package com.xxfc.platform.common.config;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
/**
* @author libin
* @version 1.0
* @description 设置请求头部信息,防止微服务之间调用请求头部信息丢失
* @data 2019/6/25 16:22
*/
@Configuration
@Component
public class HeaderConfig implements RequestInterceptor {
@Override
public void apply(RequestTemplate template) {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes instanceof ServletRequestAttributes){
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
HttpServletRequest request = servletRequestAttributes.getRequest();
//请求头设置
Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames!=null){
while (headerNames.hasMoreElements()){
String headerName = headerNames.nextElement();
String headerValue = request.getHeader(headerName);
template.header(headerName,headerValue);
}
}
}
}
}
package com.xxfc.platform.common.config;
/**
* @author libin
* @version 1.0
* @description TODO
* @data 2019/6/26 10:28
*/
public class SwaggerConfig {
}
...@@ -2,6 +2,7 @@ package com.xxfc.platform.tour.feign; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.tour.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.tour.dto.TourSpePriceDTO; import com.xxfc.platform.tour.dto.TourSpePriceDTO;
import com.xxfc.platform.tour.entity.TourGood; import com.xxfc.platform.tour.entity.TourGood;
...@@ -10,6 +11,7 @@ import com.xxfc.platform.tour.entity.TourUser; ...@@ -10,6 +11,7 @@ import com.xxfc.platform.tour.entity.TourUser;
import com.xxfc.platform.tour.vo.TourGoodOrderFindVo; import com.xxfc.platform.tour.vo.TourGoodOrderFindVo;
import com.xxfc.platform.tour.vo.TourGoodOrderVo; import com.xxfc.platform.tour.vo.TourGoodOrderVo;
import com.xxfc.platform.tour.vo.TourSpePriceVo; import com.xxfc.platform.tour.vo.TourSpePriceVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -83,4 +85,9 @@ public interface TourFeign { ...@@ -83,4 +85,9 @@ public interface TourFeign {
*/ */
@GetMapping("/tourGood/verfication/orders") @GetMapping("/tourGood/verfication/orders")
PageDataVO<TourGoodOrderVo> findTourGoodOrders(@RequestParam Map<String,Object> tourGoodOrderFindVo); PageDataVO<TourGoodOrderVo> findTourGoodOrders(@RequestParam Map<String,Object> tourGoodOrderFindVo);
@ApiOperation("首页旅游列表")
@GetMapping(value = "/tourGood/app/shopList")
public List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit",defaultValue = "4") Integer limit);
} }
...@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.constant.RestCode; import com.github.wxiaoqi.security.common.constant.RestCode;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.tour.dto.*; import com.xxfc.platform.tour.dto.*;
import com.xxfc.platform.tour.entity.*; import com.xxfc.platform.tour.entity.*;
...@@ -310,6 +311,16 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -310,6 +311,16 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
} }
} }
/**
* 首页旅游列表
* @param page
* @param limit
* @return
*/
public List<GoodDataVO> getAllByHome(Integer page, Integer limit){
return mapper.findAllByHome((page-1)*limit,limit);
};
} }
package com.xxfc.platform.tour.mapper; package com.xxfc.platform.tour.mapper;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.xxfc.platform.tour.dto.GoodSearchDTO; import com.xxfc.platform.tour.dto.GoodSearchDTO;
import com.xxfc.platform.tour.entity.TourGood; import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.vo.TourGoodVo; import com.xxfc.platform.tour.vo.TourGoodVo;
...@@ -25,4 +26,12 @@ public interface TourGoodMapper extends Mapper<TourGood> { ...@@ -25,4 +26,12 @@ public interface TourGoodMapper extends Mapper<TourGood> {
//获取商品列表 //获取商品列表
public List<TourGoodVo> findGoodList(@Param("params") GoodSearchDTO tourGoodDTO); public List<TourGoodVo> findGoodList(@Param("params") GoodSearchDTO tourGoodDTO);
/**
* 首页旅游列表
* @param start
* @param size
* @return
*/
List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size);
} }
...@@ -3,12 +3,16 @@ package com.xxfc.platform.tour.rest; ...@@ -3,12 +3,16 @@ package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
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.GoodDataVO;
import com.xxfc.platform.tour.biz.TourGoodBiz; import com.xxfc.platform.tour.biz.TourGoodBiz;
import com.xxfc.platform.tour.dto.GoodSearchDTO; import com.xxfc.platform.tour.dto.GoodSearchDTO;
import com.xxfc.platform.tour.entity.TourGood; import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.vo.TourGoodVo;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController @RestController
@RequestMapping("tourGood") @RequestMapping("tourGood")
public class TourGoodController extends BaseController<TourGoodBiz, TourGood> { public class TourGoodController extends BaseController<TourGoodBiz, TourGood> {
...@@ -41,5 +45,12 @@ public class TourGoodController extends BaseController<TourGoodBiz, TourGood> { ...@@ -41,5 +45,12 @@ public class TourGoodController extends BaseController<TourGoodBiz, TourGood> {
return ObjectRestResponse.succ(baseBiz.getOne(id)); return ObjectRestResponse.succ(baseBiz.getOne(id));
} }
@ApiOperation("首页旅游列表")
@GetMapping(value = "/app/shopList")
public List<GoodDataVO> goodList(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit",defaultValue = "4") Integer limit) {
return baseBiz.getAllByHome(page,limit);
}
} }
\ No newline at end of file
...@@ -77,6 +77,19 @@ ...@@ -77,6 +77,19 @@
</select> </select>
<!--首页查询全部-->
<select id="findAllByHome" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
SELECT g.id as `id`,g.name as `name`,g.cover as `imgUrl`,g.price,
REPLACE(GROUP_CONCAT( DISTINCT t.`name`),',','|')as name1
from tour_good g
LEFT JOIN tour_good_tag tag ON g.id=tag.good_id
LEFT JOIN tour_tag t ON tag.tag_id=t.id
where g.recommend=1
GROUP BY g.id
ORDER BY g.rank DESC ,g.id DESC
limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
</select>
<select id="getOne" resultMap="tourGoodMap"> <select id="getOne" resultMap="tourGoodMap">
SELECT * FROM tour_good WHERE id =#{id} and is_del=0 SELECT * FROM tour_good WHERE id =#{id} and is_del=0
</select> </select>
......
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