Commit 7ceb6f01 authored by libin's avatar libin

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

parents 1d5577ae 34727395
......@@ -42,7 +42,7 @@ public class BaseUserMemberLevel implements Serializable {
private Integer level;
//描述
@Column(name = "describe")
@Column(name = "describes")
@ApiModelProperty(value = "描述")
private String describe;
......
......@@ -106,9 +106,9 @@ public class TourGoodSite implements Serializable {
private Integer status;
//创建时间
@Column(name = "ctr_time")
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间")
private Long ctrTime;
private Long crtTime;
//更新时间
@Column(name = "upd_time")
......
package com.xxfc.platform.tour.biz;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.constant.RestCode;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
......@@ -17,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -33,13 +38,16 @@ import java.util.Map;
public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
@Autowired
private TourGoodBannerMapper bannerMapper;
private TourGoodBannerBiz bannerBiz;
@Autowired
private TourGoodSiteMapper siteMapper;
private TourGoodSiteBiz siteBiz;
@Autowired
private TourGoodTagMapper tagMapper;
private TourGoodTagBiz tagBiz;
@Autowired
private TourGoodSpePriceMapper priceMapper;
private TourGoodSpeBiz speBiz;
@Autowired
private UserFeign userFeign;
/**
* 查询旅游路线列表
......@@ -86,9 +94,12 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
}
TourGood good=new TourGood();
try {
Long times=System.currentTimeMillis();
BeanUtils.copyProperties(good,dto);
Integer goodId=good.getId();
good.setUpdTime(times);
if(goodId==null||goodId==0){
good.setCrtTime(times);
mapper.insertSelective(good);
goodId=good.getId();
}else {
......@@ -103,9 +114,9 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
BeanUtils.copyProperties(goodBanner,bannerDTO);
goodBanner.setGoodId(goodId);
if(bannerId==null||bannerId==0){
bannerMapper.insertSelective(goodBanner);
bannerBiz.insertSelective(goodBanner);
}else {
bannerMapper.updateByPrimaryKeySelective(goodBanner);
bannerBiz.updateSelectiveById(goodBanner);
}
}
}
......@@ -117,9 +128,9 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
BeanUtils.copyProperties(site,siteDTO);
site.setGoodId(goodId);
if(siteId==null||siteId==0){
siteMapper.insertSelective(site);
siteBiz.insertSelective(site);
}else {
siteMapper.updateByPrimaryKeySelective(site);
siteBiz.updateById(site);
}
}
}
......@@ -132,9 +143,9 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
BeanUtils.copyProperties(tag,tagDTO);
tag.setGoodId(goodId);
if(tagId==null||tagId==0){
tagMapper.insertSelective(tag);
tagBiz.insertSelective(tag);
}else {
tagMapper.updateByPrimaryKeySelective(tag);
tagBiz.updateById(tag);
}
}
}
......@@ -149,11 +160,31 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
spePrice.setPrice(price);
spePrice.setChildPrice(childPrice);
spePrice.setGoodId(goodId);
List<BaseUserMemberLevel> levelsList=userFeign.levels();
if(levelsList.size()>0){
JSONArray array=new JSONArray();
for(BaseUserMemberLevel memberLevel :levelsList){
JSONObject obj=new JSONObject();
Integer level=memberLevel.getLevel();
Integer discount=memberLevel.getDiscount();
BigDecimal price1=price.multiply(new BigDecimal(discount+"")).divide(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP);
BigDecimal price2=childPrice.multiply(new BigDecimal(discount+"")).divide(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP);
obj.put("level",level);
obj.put("price",price1);
obj.put("childPrice",price2);
array.add(obj);
}
if(array.size()>0){
String json=array.toJSONString();
spePrice.setMemberPrice(json);
}
}
if(priceId==null||priceId==0){
priceMapper.insertSelective(spePrice);
speBiz.insertSelective(spePrice);
}else {
priceMapper.updateByPrimaryKeySelective(spePrice);
speBiz.updateById(spePrice);
}
}
}
......
package com.xxfc.platform.tour.biz;
import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.tour.entity.TourGood;
......@@ -39,6 +41,8 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
TourGoodSpePriceMapper priceMapper;
@Autowired
TourGoodSiteMapper siteMapper;
@Autowired
private UserFeign userFeign;
//获取商品详情
public ObjectRestResponse<TourGoodDetailVo> getGoodDetaileById(Integer id){
......@@ -53,15 +57,20 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, 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);
List<BaseUserMemberLevel> levelsList=userFeign.levels();
if(levelsList.size()>0){
for(BaseUserMemberLevel memberLevel :levelsList){
TourMemberVo memberVo=new TourMemberVo();
memberVo.setLevel(memberLevel.getLevel());
memberVo.setName(memberLevel.getName());
BigDecimal member_price=price.multiply(new BigDecimal(memberLevel.getDiscount()+"")).divide(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP); ;
memberVo.setPrice(member_price);
memberList.add(memberVo);
}
detailVo.setMemberVo(memberList);
}
detailVo.setMemberVo(memberList);
}
//获取出行时间
......@@ -79,24 +88,7 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
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;
}
......
package com.xxfc.platform.tour.rest.admin;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourGoodBiz;
import com.xxfc.platform.tour.dto.GoodSearchDTO;
import com.xxfc.platform.tour.dto.TourGoodDTO;
import com.xxfc.platform.tour.entity.TourGood;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("good")
@IgnoreClientToken
public class TouGoodAdminController extends BaseController<TourGoodBiz, TourGood> {
@ApiOperation("后台查询旅游路线列表")
@RequestMapping(value = "/admin/goodList", method = RequestMethod.GET)
public ObjectRestResponse<TourGood> goodList(@RequestBody GoodSearchDTO dto) {
return ObjectRestResponse.succ(baseBiz.getAll(dto));
}
@ApiOperation("后台查询旅游路线列表")
@RequestMapping(value = "/admin/goodEdit", method = RequestMethod.GET)
public ObjectRestResponse<TourGood> goodEdit(@RequestBody TourGoodDTO dto) {
return ObjectRestResponse.succ(baseBiz.goodsEdit(dto));
}
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourGoodBiz;
import com.xxfc.platform.tour.dto.GoodSearchDTO;
import com.xxfc.platform.tour.dto.TourGoodDTO;
import com.xxfc.platform.tour.entity.TourGood;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
......@@ -13,25 +15,17 @@ import org.springframework.web.bind.annotation.*;
@IgnoreClientToken
public class TourGoodAdminController extends BaseController<TourGoodBiz, TourGood> {
/**
* 查询旅游路线列表
*
* @param page
* @param limit
* @param query
* @param latitude
* @param longitude
* @param tagId
* @param distance
* @return
*/
@ApiOperation("查询旅游路线列表")
@RequestMapping(value = "//getGoodList", method = RequestMethod.GET)
@ApiOperation("后台查询旅游路线列表")
@RequestMapping(value = "/admin/goodList", method = RequestMethod.GET)
public ObjectRestResponse<TourGood> goodList(@RequestBody GoodSearchDTO dto) {
return ObjectRestResponse.succ(baseBiz.getAll(dto));
}
public ObjectRestResponse<TourGood> getGoodList(@RequestParam(value = "page", required = true) Integer page, @RequestParam(value = "limit", required = true) Integer limit,
@RequestParam(value = "query", required = false) 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);
@ApiOperation("后台查询旅游路线列表")
@RequestMapping(value = "/admin/goodEdit", method = RequestMethod.GET)
public ObjectRestResponse<TourGood> goodEdit(@RequestBody TourGoodDTO dto) {
return ObjectRestResponse.succ(baseBiz.goodsEdit(dto));
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@
<result property="type" column="type"/>
<result property="rank" column="rank"/>
<result property="status" column="status"/>
<result property="ctrTime" column="ctr_time"/>
<result property="crtTime" column="crt_time"/>
<result property="updTime" column="upd_time"/>
<result property="intro" column="intro"/>
<result property="isDel" column="is_del"/>
......
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