Commit 9c8f0f6a authored by hezhen's avatar hezhen

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

# Conflicts:
#	xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourGoodSpeController.java
parents 23a8f008 0361322c
......@@ -13,6 +13,7 @@ import java.util.List;
@Data
public class TourBO extends OrderTourDetail implements OrderDetail {
private BaseOrder order;
// private Tour
List<TourUser> tourUsers;
Integer number;
Integer childNumber;
}
......@@ -47,9 +47,9 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
@ResponseBody
@ApiOperation(value = "价格计算")
@IgnoreUserToken
public ObjectRestResponse<TourPriceVO> calculatePrice(OrderRentVehicleController.CalculatePriceVO vo){
public ObjectRestResponse<TourPriceVO> calculatePrice(CalculatePriceVO vo){
TourBO bo = BeanUtil.toBean(vo, TourBO.class);
return new ObjectRestResponse<>().rel(true).data(orderTourService.calculatePrice(bo));
return ObjectRestResponse.succ(orderTourService.calculatePrice(bo));
}
@Data
......
......@@ -16,6 +16,8 @@ import com.xxfc.platform.order.entity.OrderCostDetail;
import com.xxfc.platform.order.pojo.order.RentVehicleBO;
import com.xxfc.platform.order.pojo.order.TourBO;
import com.xxfc.platform.order.pojo.price.RentVehiclePriceVO;
import com.xxfc.platform.tour.dto.TourSpePriceDTO;
import com.xxfc.platform.tour.feign.TourFeign;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.log4j.Log4j;
......@@ -29,6 +31,9 @@ import java.math.BigDecimal;
@Log4j
public class OrderTourService extends AbstractOrderHandle<OrderRentVehicleBiz, TourBO> {
@Autowired
TourFeign tourFeign;
private static BigDecimal DRIVER_PRICE = new BigDecimal("600.00");
private static BigDecimal DAMAGE_SAFE = new BigDecimal("100.00"); //车损免赔
// private static BigDecimal DEPOSIT = new BigDecimal("20000.00");
......@@ -80,6 +85,12 @@ public class OrderTourService extends AbstractOrderHandle<OrderRentVehicleBiz, T
BigDecimal goodsAmount = BigDecimal.ZERO;
BigDecimal tourAmount = BigDecimal.ZERO;
//计算旅游价格
tourFeign.refund(new TourSpePriceDTO(){{
setChildNumber(detail.getChildNumber());
setChildNumber(detail.getChildNumber());
}});
//计算价格
//计算车辆费用
// VehicleModel vehicleModel = vehicleFeign.get(detail.getModelId()).getData();
......@@ -108,7 +119,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderRentVehicleBiz, T
rvp.setVehicleNum(1);
rvp.setDriverNum(1);
detail.setCostDetail(costDetail(rvp));
//detail.setCostDetail(costDetail(rvp));
return rvp;
}
......
......@@ -4,16 +4,18 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.rest.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
@Slf4j
public class TourBaseController<Biz extends BaseBiz> {
@Autowired
protected HttpServletRequest request;
@Autowired
protected Biz baseBiz;
@Autowired
protected HttpServletRequest request;
@Autowired
protected UserFeign userFeign;
@Autowired
......
......@@ -4,13 +4,11 @@ package com.xxfc.platform.tour.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 计算价格
*/
@Data
public class TourSpePriceDto {
public class TourSpePriceDTO {
//用户id
@ApiModelProperty(value = "用户id")
......
......@@ -65,5 +65,10 @@ public class TourBanner implements Serializable {
@ApiModelProperty(value = "是否删除,0否,1是")
private Integer isDel;
@Column(name = "rank")
@ApiModelProperty(value = "排序")
private Integer rank;
}
......@@ -66,4 +66,9 @@ public class TourUser implements Serializable {
private Integer isdel;
@Column(name = "is_child")
@ApiModelProperty(value = "是否删除:0-儿童;1-大人")
private Integer isChild;
}
......@@ -2,7 +2,7 @@ package com.xxfc.platform.tour.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.tour.dto.TourSpePriceDto;
import com.xxfc.platform.tour.dto.TourSpePriceDTO;
import com.xxfc.platform.tour.vo.TourSpePriceVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -18,8 +18,15 @@ import org.springframework.web.bind.annotation.RequestMethod;
*/
@FeignClient(value = "xx-tour")
public interface TourFeign {
/**
* 计算价格
* @param spePriceDto
* @return
*/
@RequestMapping(value = "/spe/user/prices", method = RequestMethod.POST)
public ObjectRestResponse<TourSpePriceVo> prices(@RequestBody TourSpePriceDto spePriceDto);
public ObjectRestResponse<TourSpePriceVo> refund(@RequestBody TourSpePriceDTO spePriceDto);
@RequestMapping(value = "/spe/stock", method = RequestMethod.GET)
public ObjectRestResponse<TourSpePriceVo> stock(Integer speId,Integer number);
......
......@@ -14,4 +14,6 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class TourBannerBiz extends BaseBiz<TourBannerMapper,TourBanner> {
}
\ No newline at end of file
......@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.tour.dto.TourSpePriceDto;
import com.xxfc.platform.tour.dto.TourSpePriceDTO;
import com.xxfc.platform.tour.entity.TourGoodSpePrice;
import com.xxfc.platform.tour.mapper.TourGoodSpePriceMapper;
import com.xxfc.platform.tour.vo.TourSpePriceVo;
......@@ -27,7 +27,7 @@ import java.math.RoundingMode;
@Slf4j
public class TourGoodSpeBiz extends BaseBiz<TourGoodSpePriceMapper, TourGoodSpePrice> {
public ObjectRestResponse<TourSpePriceVo> getPricesByuserid(TourSpePriceDto priceDto) {
public ObjectRestResponse<TourSpePriceVo> getPricesByuserid(TourSpePriceDTO priceDto) {
if (priceDto == null || priceDto.getUserId() == null || priceDto.getUserId() == 0 ||
priceDto.getNumber() == null || priceDto.getNumber() == 0||priceDto.getSpeId()==null) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
......
......@@ -15,4 +15,5 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class TourGoodTagBiz extends BaseBiz<TourGoodTagMapper,TourGoodTag> {
}
\ No newline at end of file
package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourBanner;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* 首页banner图
*
......@@ -10,6 +14,9 @@ import tk.mybatis.mapper.common.Mapper;
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Repository
public interface TourBannerMapper extends Mapper<TourBanner> {
@Select("select * from tour_banner where is_del=${isDel} order by rank ASC")
List<TourBanner> findBannerListByisDelOrderByRank(TourBanner banner);
}
package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourTag;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* 旅游路线标签
*
......@@ -10,6 +14,11 @@ import tk.mybatis.mapper.common.Mapper;
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Repository
public interface TourTagMapper extends Mapper<TourTag> {
@Select("select * from tour_tag where is_del=${isDel} and is_hot=${isHot} order by rank ASC")
List<TourTag> findHotListTag(TourTag tag);
@Select("select * from tour_tag where is_del=${isDel} order by rank ASC")
List<TourTag> findAllByIsDel(TourTag tagBanner);
}
......@@ -2,8 +2,13 @@ package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourUser;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* 出游人信息
*
......@@ -11,6 +16,9 @@ import tk.mybatis.mapper.common.Mapper;
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Repository
public interface TourUserMapper extends Mapper<TourUser> {
@Select("select * from tour_user where userid=${userid} and is_child=${isChild} and isdel=${isdel}")
List<TourUser> findListByTourUser(TourUser user);
}
package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.common.msg.ListRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourBannerBiz;
import com.xxfc.platform.tour.entity.TourBanner;
import com.xxfc.platform.tour.service.TourBannerService;
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.RestController;
import java.util.List;
/**
* banner图
*/
@RestController
@RequestMapping("tourBanner")
public class TourBannerController extends BaseController<TourBannerBiz,TourBanner> {
@Autowired
private TourBannerService bannerService;
/**
*查询banner图
* @return
*/
@GetMapping("/app/unauth/findBannerlist")
public ListRestResponse findBannerlist(){
List<TourBanner> bannerList = bannerService.findBannerList();
return new ListRestResponse().result(bannerList).count(bannerList.size());
}
}
\ No newline at end of file
package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.tour.biz.TourGoodSpeBiz;
import com.xxfc.platform.tour.common.TourBaseController;
import com.xxfc.platform.tour.dto.TourSpePriceDto;
import com.xxfc.platform.tour.dto.TourSpePriceDTO;
import com.xxfc.platform.tour.vo.TourSpePriceVo;
import org.springframework.web.bind.annotation.*;
......@@ -19,7 +18,7 @@ public class TourGoodSpeController extends TourBaseController<TourGoodSpeBiz> {
//获取价格
@RequestMapping(value = "/user/prices", method = RequestMethod.POST)
public ObjectRestResponse<TourSpePriceVo> prices(@RequestBody TourSpePriceDto priceDto) {
public ObjectRestResponse<TourSpePriceVo> prices(@RequestBody TourSpePriceDTO priceDto) {
return baseBiz.getPricesByuserid(priceDto);
}
......
package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.common.msg.ListRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourTagBannerBiz;
import com.xxfc.platform.tour.entity.TourTagBanner;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xxfc.platform.tour.service.TourTagBannerService;
import com.xxfc.platform.tour.service.TourTagService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("tourTagBanner")
public class TourTagBannerController extends BaseController<TourTagBannerBiz,TourTagBanner> {
@Autowired
private TourTagBannerService tagBannerService;
@GetMapping("/app/unauth/findById/{tid}")
public ListRestResponse findById(@PathVariable long tid){
List<TourTagBanner> tourTagBanners = tagBannerService.findById(tid);
return new ListRestResponse().result(tourTagBanners).count(tourTagBanners.size());
}
}
\ No newline at end of file
package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.common.msg.ListRestResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourGoodTagBiz;
import com.xxfc.platform.tour.biz.TourTagBiz;
import com.xxfc.platform.tour.entity.TourTag;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xxfc.platform.tour.entity.TourTagBanner;
import com.xxfc.platform.tour.service.TourTagBannerService;
import com.xxfc.platform.tour.service.TourTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("tourTag")
public class TourTagController extends BaseController<TourTagBiz,TourTag> {
@Autowired
private TourTagService tagService;
@GetMapping("/app/unauth/getTagList")
public ListRestResponse getTagList(@RequestBody Map map){
if (map==null||map.keySet().size()==0) {
new ListRestResponse<>().result("错误");
}
int hot = (int) map.get("hot");
if (hot==1){
List<TourTag> hotTag = tagService.getHotTag();
return new ListRestResponse().result(hotTag).count(hotTag.size());
}
List<TourTag> Tags= tagService.findAll(map);
return new ListRestResponse().result(Tags).count(Tags.size());
}
}
\ No newline at end of file
package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.msg.ListRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourUserBiz;
import com.xxfc.platform.tour.common.TourBaseController;
import com.xxfc.platform.tour.entity.TourUser;
import com.xxfc.platform.tour.service.TourUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("tourUser")
public class TourUserController extends BaseController<TourUserBiz,TourUser> {
public class TourUserController extends TourBaseController<TourUserBiz> {
@Autowired
private TourUserService userService;
@GetMapping("/app/unauth/getTourUser/{isChild}")
public ListRestResponse getTourUser(@PathVariable int isChild){
// AppUserDTO userInfo = getUserInfo();
// Integer id = userInfo.getId();
Integer id =14;
List<TourUser> tourUsers= userService.getTourUser(id,isChild);
return new ListRestResponse().result(tourUsers).count(tourUsers.size());
}
}
\ No newline at end of file
package com.xxfc.platform.tour.service;
import com.github.wxiaoqi.security.common.service.impl.BaseServiceImpl;
import com.xxfc.platform.tour.entity.TourBanner;
import com.xxfc.platform.tour.mapper.TourBannerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Administrator
*/
@Service
public class TourBannerService extends BaseServiceImpl<TourBannerMapper,TourBanner> {
@Autowired
private TourBannerMapper bannerMapper;
@Autowired
private RedisTemplate redisTemplate;
public List<TourBanner> findBannerList() {
TourBanner banner = new TourBanner();
banner.setIsDel(0);
List<TourBanner> bannerList = (List<TourBanner>) redisTemplate.opsForValue().get("homeBanner");
if (bannerList==null||bannerList.size()==0) {
bannerList = bannerMapper.findBannerListByisDelOrderByRank(banner);
redisTemplate.opsForValue().set("homeBanner",bannerList);
}
return bannerList;
}
}
package com.xxfc.platform.tour.service;
import com.xxfc.platform.tour.biz.TourTagBannerBiz;
import com.xxfc.platform.tour.entity.TourTagBanner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TourTagBannerService {
@Autowired
private TourTagBannerBiz tagBannerBiz;
public List<TourTagBanner> findById(long tid) {
TourTagBanner tourTagBanner = new TourTagBanner();
tourTagBanner.setId(tid);
tourTagBanner.setIsDel(0);
return tagBannerBiz.selectList(tourTagBanner);
}
}
package com.xxfc.platform.tour.service;
import com.github.pagehelper.PageInfo;
import com.xxfc.platform.tour.biz.TourTagBiz;
import com.xxfc.platform.tour.entity.TourTag;
import com.xxfc.platform.tour.mapper.TourTagMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.awt.print.Pageable;
import java.util.List;
import java.util.Map;
@Service
public class TourTagService {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private TourTagMapper tagMapper;
@Autowired
private TourTagBiz tagBiz;
public List<TourTag> getHotTag() {
List<TourTag> hotTagList = (List<TourTag>) redisTemplate.opsForValue().get("hotTag");
if (hotTagList==null||hotTagList.size()==0) {
System.out.println("mysql");
TourTag tag = new TourTag();
tag.setIsDel(0);
tag.setIsHot(1);
List<TourTag> tagList=tagMapper.findHotListTag(tag);
redisTemplate.opsForValue().set("hotTag",tagList);
}
return hotTagList;
}
public List<TourTag> findAll(Map map) {
TourTag tagBanner = new TourTag();
tagBanner.setIsDel(0);
return tagMapper.findAllByIsDel(tagBanner);
}
}
package com.xxfc.platform.tour.service;
import com.github.wxiaoqi.security.admin.biz.UserBiz;
import com.xxfc.platform.tour.biz.TourUserBiz;
import com.xxfc.platform.tour.entity.TourUser;
import com.xxfc.platform.tour.mapper.TourUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TourUserService {
@Autowired
private TourUserMapper userMapper;
public List<TourUser> getTourUser(Integer id, Integer isChild) {
TourUser user = new TourUser();
user.setUserid(id);
user.setIsdel(0);
user.setIsChild(isChild);
return userMapper.findListByTourUser(user);
}
}
......@@ -23,7 +23,7 @@ spring:
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848
server-addr: 10.1.37.192:8848
---
spring:
......
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