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