Commit e1c55168 authored by hezhen's avatar hezhen

添加旅游

parent e300a0bd
...@@ -115,6 +115,11 @@ public class TourGood implements Serializable { ...@@ -115,6 +115,11 @@ public class TourGood implements Serializable {
@Column(name = "unit") @Column(name = "unit")
@ApiModelProperty(value = "单位") @ApiModelProperty(value = "单位")
private String unit; private String unit;
//是否删除,0否,1是
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除,0否,1是")
private Integer isDel;
} }
...@@ -39,8 +39,14 @@ public class TourGoodSite implements Serializable { ...@@ -39,8 +39,14 @@ public class TourGoodSite implements Serializable {
@Column(name = "address") @Column(name = "address")
@ApiModelProperty(value = "站点地址") @ApiModelProperty(value = "站点地址")
private String address; private String address;
//出发时间 //分公司id
@Column(name = "company_id")
@ApiModelProperty(value = "分公司id")
private String companyId;
//出发时间
@Column(name = "depart_time") @Column(name = "depart_time")
@ApiModelProperty(value = "出发时间") @ApiModelProperty(value = "出发时间")
private Long departTime; private Long departTime;
......
package com.xxfc.platform.tour.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 出发时间
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Data
public class TourDepartTimeVo {
@ApiModelProperty("")
private Integer id;
//商品id
@ApiModelProperty(value = "商品id")
private Integer goodId;
//出行时间
@ApiModelProperty(value = "出行时间")
private String startTime;
//出行时间
@ApiModelProperty(value = "结束时间")
private String endTime;
//出行时间
@ApiModelProperty(value = "出行周几")
private Integer startWeek;
//结束时间
@ApiModelProperty(value = "结束周几")
private Integer endWeek;
//规格id
@ApiModelProperty(value = "规格id")
private String speId;
//价格
@ApiModelProperty(value = "价格")
private BigDecimal price;
//儿童价格
@ApiModelProperty(value = "儿童价格")
private BigDecimal childPrice;
//会员价格
@ApiModelProperty(value = "会员价格")
private String memberPrice;
//库存
@ApiModelProperty(value = "库存")
private Integer stock;
}
package com.xxfc.platform.tour.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 出发地址
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Data
public class TourDepartVo {
private Integer id;
//路线id
@ApiModelProperty(value = "路线id")
private Integer goodId;
//站点名称
@ApiModelProperty(value = "站点名称")
private String name;
//站点地址
@ApiModelProperty(value = "站点地址")
private String address;
//分公司id
@ApiModelProperty(value = "分公司id")
private String companyId;
//出发时间
@ApiModelProperty(value = "出发时间")
private Long departTime;
//站点经度
@ApiModelProperty(value = "站点经度")
private Double longitude;
//站点纬度
@ApiModelProperty(value = "站点纬度")
private Double latitude;
//站点介绍
@ApiModelProperty(value = "站点介绍")
private String intro;
//类型
@ApiModelProperty(value = "类型")
private Integer type;
}
package com.xxfc.platform.tour.vo;
import java.math.BigDecimal;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 旅游商品表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Data
public class TourGoodDetailVo {
private Integer id;
//商品名
@ApiModelProperty(value = "商品名")
private String name;
//商品封面图
@ApiModelProperty(value = "商品封面图")
private String cover;
//商品原价
@ApiModelProperty(value = "商品原价")
private BigDecimal price;
//儿童价格
@ApiModelProperty(value = "儿童价格")
private BigDecimal childPrice;
//商品浏览量
@ApiModelProperty(value = "商品浏览量")
private Integer viewCount;
//商品销售量
@ApiModelProperty(value = "商品销售量")
private Integer saleCount;
//商品描述
@ApiModelProperty(value = "商品描述")
private String describe;
//商品详情(行程亮点)
@ApiModelProperty(value = "商品详情(行程亮点)")
private String content;
//行程介绍
@ApiModelProperty(value = "行程介绍")
private String introduce;
//费用说明
@ApiModelProperty(value = "费用说明")
private String explain;
//排序
@ApiModelProperty(value = "排序")
private Integer rank;
//状态:0-未发布;1-上架;2-下架
@ApiModelProperty(value = "状态:0-未发布;1-上架;2-下架")
private Integer status;
//创建时间
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
//更新时间
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
//是否推荐:0-未推荐;1-已推荐
@ApiModelProperty(value = "是否推荐:0-未推荐;1-已推荐")
private Integer recommend;
//是否会员价:0-否;1-是
@ApiModelProperty(value = "是否会员价:0-否;1-是")
private Integer isMember;
//库存
@ApiModelProperty(value = "库存")
private Integer stock;
//单位
@ApiModelProperty(value = "单位")
private String unit;
//等级价格
@ApiModelProperty(value = "等级价格")
private List<TourMemberVo> memberVo;
//出发时间
@ApiModelProperty(value = "出发时间")
private List<TourDepartTimeVo> tourDepartTimeVo;
//出发地点
@ApiModelProperty(value = "出发地点")
private List<TourDepartVo> tourDepartVo;
//目的地
@ApiModelProperty(value = "目的地")
private String destination;
}
package com.xxfc.platform.tour.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 等级金额表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Data
public class TourMemberVo {
//等级名称
@ApiModelProperty(value = "等级名称")
private String name;
//等级
@ApiModelProperty(value = "等级")
private Integer level;
//金额
@ApiModelProperty(value = "金额")
private BigDecimal price;
}
package com.xxfc.platform.tour.biz; package com.xxfc.platform.tour.biz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.tour.mapper.TourGoodMapper; import com.xxfc.platform.tour.mapper.TourGoodMapper;
import com.xxfc.platform.tour.mapper.TourGoodSiteMapper;
import com.xxfc.platform.tour.mapper.TourGoodSpePriceMapper;
import com.xxfc.platform.tour.vo.TourDepartTimeVo;
import com.xxfc.platform.tour.vo.TourDepartVo;
import com.xxfc.platform.tour.vo.TourGoodDetailVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGood; import com.xxfc.platform.tour.entity.TourGood;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
/** /**
* 旅游商品表 * 旅游商品表
* *
...@@ -14,5 +26,9 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -14,5 +26,9 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
* @date 2019-06-06 11:41:51 * @date 2019-06-06 11:41:51
*/ */
@Service @Service
@Slf4j
public class TourGoodBiz extends BaseBiz<TourGoodMapper,TourGood> { public class TourGoodBiz extends BaseBiz<TourGoodMapper,TourGood> {
} }
\ No newline at end of file
package com.xxfc.platform.tour.biz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.mapper.TourGoodMapper;
import com.xxfc.platform.tour.mapper.TourGoodSiteMapper;
import com.xxfc.platform.tour.mapper.TourGoodSpePriceMapper;
import com.xxfc.platform.tour.vo.TourDepartTimeVo;
import com.xxfc.platform.tour.vo.TourDepartVo;
import com.xxfc.platform.tour.vo.TourGoodDetailVo;
import com.xxfc.platform.tour.vo.TourMemberVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGoodSpePrice;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
/**
* 旅游商品规格价格表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Service
@Slf4j
public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
@Autowired
TourGoodSpePriceMapper priceMapper;
@Autowired
TourGoodSiteMapper siteMapper;
//获取商品详情
public ObjectRestResponse<TourGoodDetailVo> getGoodDetaileById(Integer id){
if(id==null||id==0){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
try {
TourGood TourGood = mapper.getOne(id);
if (TourGood != null) {
TourGoodDetailVo detailVo = new TourGoodDetailVo();
BeanUtils.copyProperties(detailVo, TourGood);
BigDecimal price=detailVo.getPrice();
if(price!=null&&detailVo.getIsMember()>0){
List<TourMemberVo> memberList=new ArrayList<>();
for(int i=1;i<4;i++){
TourMemberVo memberVo=new TourMemberVo();
memberVo.setLevel(i);
memberVo.setName(getName(i));
BigDecimal member_price=price.multiply(new BigDecimal("0.88")).setScale(2, RoundingMode.HALF_UP); ;
memberVo.setPrice(member_price);
memberList.add(memberVo);
}
detailVo.setMemberVo(memberList);
}
//获取出行时间
List<TourDepartTimeVo> timelist=priceMapper.getAllByGoodId(id);
detailVo.setTourDepartTimeVo(timelist);
//获取出发地点
List<TourDepartVo> departList=siteMapper.getlistByGoodId(id);
detailVo.setTourDepartVo(departList);
return ObjectRestResponse.succ(detailVo);
}
return ObjectRestResponse.createDefaultFail();
}catch (Exception e) {
e.printStackTrace();
log.error("---商品详情---id====="+id+"----异常---msg==="+ e.getMessage());
return ObjectRestResponse.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
}
}
public String getName(Integer type){
String name="";
switch (type){
case 1:
name="普通会员";
break;
case 2:
name="黄金会员";
break;
case 3:
name="钻石会员";
break;
}
return name;
}
}
\ No newline at end of file
package com.xxfc.platform.tour.biz;
import com.xxfc.platform.tour.mapper.TourGoodSpePriceMapper;
import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGoodSpePrice;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
/**
* 旅游商品规格价格表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Service
public class TourGoodSpePriceBiz extends BaseBiz<TourGoodSpePriceMapper,TourGoodSpePrice> {
}
\ No newline at end of file
package com.xxfc.platform.tour.mapper; package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourGood; import com.xxfc.platform.tour.entity.TourGood;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
/** /**
...@@ -11,5 +12,8 @@ import tk.mybatis.mapper.common.Mapper; ...@@ -11,5 +12,8 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2019-06-06 11:41:51 * @date 2019-06-06 11:41:51
*/ */
public interface TourGoodMapper extends Mapper<TourGood> { public interface TourGoodMapper extends Mapper<TourGood> {
//获取商品信息
public TourGood getOne(@Param("id")Integer id);
} }
package com.xxfc.platform.tour.mapper; package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourGoodSite; import com.xxfc.platform.tour.entity.TourGoodSite;
import com.xxfc.platform.tour.vo.TourDepartVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/** /**
* 路线站点表 * 路线站点表
* *
...@@ -11,5 +15,8 @@ import tk.mybatis.mapper.common.Mapper; ...@@ -11,5 +15,8 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2019-06-06 11:41:51 * @date 2019-06-06 11:41:51
*/ */
public interface TourGoodSiteMapper extends Mapper<TourGoodSite> { public interface TourGoodSiteMapper extends Mapper<TourGoodSite> {
public List<TourDepartVo> getlistByGoodId(@Param("goodId") Integer goodId);
} }
package com.xxfc.platform.tour.mapper; package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourGoodSpePrice; import com.xxfc.platform.tour.entity.TourGoodSpePrice;
import com.xxfc.platform.tour.vo.TourDepartTimeVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/** /**
* 旅游商品规格价格表 * 旅游商品规格价格表
* *
...@@ -11,5 +15,9 @@ import tk.mybatis.mapper.common.Mapper; ...@@ -11,5 +15,9 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2019-06-06 11:41:51 * @date 2019-06-06 11:41:51
*/ */
public interface TourGoodSpePriceMapper extends Mapper<TourGoodSpePrice> { public interface TourGoodSpePriceMapper extends Mapper<TourGoodSpePrice> {
List<TourDepartTimeVo> getAllByGoodId(@Param("goodId") Integer goodId);
} }
...@@ -10,4 +10,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -10,4 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("tourGood") @RequestMapping("tourGood")
public class TourGoodController extends BaseController<TourGoodBiz,TourGood> { public class TourGoodController extends BaseController<TourGoodBiz,TourGood> {
} }
\ No newline at end of file
package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.tour.biz.TourGoodDetailBiz;
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;
@RestController
@RequestMapping("good")
public class TourGoodDetailController{
@Autowired
TourGoodDetailBiz detailBiz;
//获取商品详情
@RequestMapping(value = "/app/unauth/details", method = RequestMethod.GET) //匹配的是href中的download请求
public ObjectRestResponse details(@RequestParam(value = "goodId",defaultValue = "0") Integer goodId) {
return detailBiz.getGoodDetaileById(goodId);
}
}
\ No newline at end of file
package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourGoodSpePriceBiz;
import com.xxfc.platform.tour.entity.TourGoodSpePrice;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("tourGoodSpePrice")
public class TourGoodSpePriceController extends BaseController<TourGoodSpePriceBiz,TourGoodSpePrice> {
}
\ No newline at end of file
...@@ -20,5 +20,24 @@ ...@@ -20,5 +20,24 @@
<result property="intro" column="intro"/> <result property="intro" column="intro"/>
<result property="isDel" column="is_del"/> <result property="isDel" column="is_del"/>
</resultMap> </resultMap>
<resultMap type="com.xxfc.platform.tour.vo.TourDepartVo" id="tourDepartVoMap">
<result property="id" column="id"/>
<result property="goodId" column="good_id"/>
<result property="name" column="name"/>
<result property="address" column="address"/>
<result property="companyId" column="company_id"/>
<result property="departTime" column="depart_time"/>
<result property="longitude" column="longitude"/>
<result property="latitude" column="latitude"/>
<result property="type" column="type"/>
<result property="intro" column="intro"/>
</resultMap>
<!-- 获取出行时间 -->
<select id="getlistByGoodId" resultMap="tourDepartVoMap">
SELECT id,good_id,name,address,company_id,depart_time,longitude,latitude,type,intro FROM tour_good_site
WHERE good_id=#{goodId} and is_del=0
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -19,4 +19,27 @@ ...@@ -19,4 +19,27 @@
<result property="isDel" column="is_del"/> <result property="isDel" column="is_del"/>
</resultMap> </resultMap>
<resultMap type="com.xxfc.platform.tour.vo.TourDepartTimeVo" id="tourDepartTimeVoMap">
<result property="id" column="id"/>
<result property="goodId" column="good_id"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="speId" column="spe_id"/>
<result property="price" column="price"/>
<result property="childPrice" column="child_price"/>
<result property="memberPrice" column="member_price"/>
<result property="stock" column="stock"/>
<result property="startWeek" column="startWeek"/>
<result property="endWeek" column="endWeek"/>
</resultMap>
<!-- 获取出行时间 -->
<select id="getAllByGoodId" resultMap="tourDepartTimeVoMap">
SELECT id,good_id,good_id,DATE_FORMAT(start_time,'%Y-%m-%d') as start_time,DATE_FORMAT(end_time,'%Y-%m-%d') as end_time,spe_id,price,child_price,member_price,stock,
DATE_FORMAT(start_time,'%w') as startWeek,DATE_FORMAT(end_time,'%w') as endWeek
FROM tour_good_spe_price WHERE good_id=#{goodId} and is_del=0
</select>
</mapper> </mapper>
\ 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