Commit 4b10f1f9 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/base-modify' into base-modify

# Conflicts:
#	xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/biz/TourGoodBiz.java
parents ce55c639 a8d88dfc
package com.github.wxiaoqi.security.common.msg;
import com.github.wxiaoqi.security.common.constant.RestCode;
import com.github.wxiaoqi.security.common.util.SystemProperty;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
/**
* Created by Ace on 2017/6/11.
......@@ -9,6 +11,10 @@ public class ObjectRestResponse<T> extends BaseResponse {
T data;
boolean rel;
private static final Integer WEB_CALL_RESULT_SUCCESS = ResultCode.SUCCESS_CODE;
private static final Integer WEB_CALL_RESULT_FAILED = ResultCode.FAILED_CODE;
private static final String RESULT_SUCCESS_MSG = "操作成功";
private static final String RESULT_FAIL_MSG = "操作失败";
public boolean isRel() {
return rel;
......@@ -54,4 +60,30 @@ public class ObjectRestResponse<T> extends BaseResponse {
public static <T> ObjectRestResponse succ(T data) {
return new ObjectRestResponse().status(RestCode.SUCCESS.getStatus()).msg(RestCode.SUCCESS.getMsg()).data(data).rel(true);
}
/**
* 创建一个异常的调用结果,根据code获取对应的提示
* @param code
* @return
*/
public static ObjectRestResponse createFailedResultMsg(Integer code) {
return new ObjectRestResponse().status(code).msg(SystemProperty.getResultConfig(code + "")).rel(false);
}
/**
* 创建一个异常的调用结果
* @param message
* @return
*/
public static ObjectRestResponse createFailedResult(Integer code, String message) {
return new ObjectRestResponse().status(code).msg(message).rel(false);
}
/**
* 操作失败
* @return
*/
public static ObjectRestResponse createDefaultFail() {
return new ObjectRestResponse().status(WEB_CALL_RESULT_FAILED).msg(RESULT_FAIL_MSG).rel(false);
}
}
......@@ -115,6 +115,11 @@ public class TourGood implements Serializable {
@Column(name = "unit")
@ApiModelProperty(value = "单位")
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 {
@Column(name = "address")
@ApiModelProperty(value = "站点地址")
private String address;
//出发时间
//分公司id
@Column(name = "company_id")
@ApiModelProperty(value = "分公司id")
private String companyId;
//出发时间
@Column(name = "depart_time")
@ApiModelProperty(value = "出发时间")
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;
import com.github.pagehelper.PageHelper;
import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.msg.ListRestResponse;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.mapper.TourGoodMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xxfc.platform.tour.entity.TourGood;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -24,11 +20,23 @@ import java.util.Map;
* @date 2019-06-06 11:41:51
*/
@Service
public class TourGoodBiz extends BaseBiz<TourGoodMapper,TourGood> {
@Slf4j
public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
@Autowired
private TourGoodMapper tourGoodMapper;
/**
* 查询旅游路线列表
* @param page
* @param limit
* @param query
* @param latitude
* @param longitude
* @param tagId
* @param distance
* @return
*/
public PageDataVO<TourGood> getGoodList(int page, int limit , String query , Double latitude, Double longitude, Integer tagId, Double distance){
Map<String, Object> params = initParam(page, limit, query, latitude, longitude, tagId, distance);
return PageDataVO.pageInfo(mapper.getGoodList(params));
......
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
......@@ -2,9 +2,7 @@ package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourGood;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
......@@ -16,5 +14,10 @@ import java.util.Map;
* @date 2019-06-06 11:41:51
*/
public interface TourGoodMapper extends Mapper<TourGood> {
//获取商品信息
public TourGood getOne(@Param("id")Integer id);
//查询旅游路线列表
public List<TourGood> getGoodList(@Param("params") Map<String,Object> map);
}
package com.xxfc.platform.tour.mapper;
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 java.util.List;
/**
* 路线站点表
*
......@@ -11,5 +15,8 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2019-06-06 11:41:51
*/
public interface TourGoodSiteMapper extends Mapper<TourGoodSite> {
public List<TourDepartVo> getlistByGoodId(@Param("goodId") Integer goodId);
}
package com.xxfc.platform.tour.mapper;
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 java.util.List;
/**
* 旅游商品规格价格表
*
......@@ -11,5 +15,9 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2019-06-06 11:41:51
*/
public interface TourGoodSpePriceMapper extends Mapper<TourGoodSpePrice> {
List<TourDepartTimeVo> getAllByGoodId(@Param("goodId") Integer goodId);
}
......@@ -13,17 +13,28 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("tourGood")
public class TourGoodController extends BaseController<TourGoodBiz,TourGood> {
public class TourGoodController extends BaseController<TourGoodBiz, TourGood> {
@ApiOperation("订单详情")
@RequestMapping(value = "/app/unauth/getGoodList",method = RequestMethod.GET)
//@GetMapping(value = "/app/unauth/getGoodList")
/**
* 查询旅游路线列表
*
* @param page
* @param limit
* @param query
* @param latitude
* @param longitude
* @param tagId
* @param distance
* @return
*/
@ApiOperation("查询旅游路线列表")
@RequestMapping(value = "/app/unauth/getGoodList", method = RequestMethod.GET)
@IgnoreClientToken
@ResponseBody
public PageDataVO<TourGood> getGoodList(@RequestParam(value = "page", required=true) Integer page, @RequestParam(value = "limit", required=true) Integer limit ,
@RequestParam(value = "query") String query , @RequestParam(value = "latitude", required=false) Double latitude, @RequestParam(value = "longitude", required=false) Double longitude,
@RequestParam(value = "tagId", required=false) Integer tagId, @RequestParam(value = "distance",defaultValue = "10.00") Double distance){
//BaseResponse baseResponse = new BaseResponse();
public PageDataVO<TourGood> getGoodList(@RequestParam(value = "page", required = true) Integer page, @RequestParam(value = "limit", required = true) Integer limit,
@RequestParam(value = "query") String query, @RequestParam(value = "latitude", required = false) Double latitude,
@RequestParam(value = "longitude", required = false) Double longitude, @RequestParam(value = "tagId", required = false) Integer tagId,
@RequestParam(value = "distance", defaultValue = "10.00") Double distance) {
return baseBiz.getGoodList(page, limit, query, latitude, longitude, tagId, distance);
}
}
\ 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
......@@ -25,6 +25,7 @@
<result property="unit" column="unit"/>
</resultMap>
<!--查询旅游路线列表-->
<select id="getGoodList" parameterType="java.util.Map" resultMap="tourGoodMap">
SELECT * from tour_good t
where 1=1
......@@ -49,4 +50,8 @@
</if>
</select>
<select id="getOne" resultMap="tourGoodMap">
SELECT * FROM tour_good WHERE id =#{id} and is_del=0
</select>
</mapper>
\ No newline at end of file
......@@ -20,5 +20,24 @@
<result property="intro" column="intro"/>
<result property="isDel" column="is_del"/>
</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>
\ No newline at end of file
......@@ -19,4 +19,27 @@
<result property="isDel" column="is_del"/>
</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>
\ 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