Commit 8c89acf5 authored by hezhen's avatar hezhen

修改收藏

parent 657bfda9
......@@ -16,11 +16,14 @@ public class AppUserCollectDTO {
@ApiModelProperty("用户id")
private Integer userId;
@ApiModelProperty("收藏类型;1-租车;2-旅游")
@ApiModelProperty("收藏类型;1-商品;2-旅游;3-营地")
private Integer type;
@ApiModelProperty("类型id")
private Integer typeId;
@ApiModelProperty("商品id")
private String typeId;
@ApiModelProperty("商品类型:1--房车;2--机车;3--游艇")
private Integer goodsType;
@ApiModelProperty("类型id名称")
private String name;
......
......@@ -29,7 +29,12 @@ public class AppUserCollect {
@ApiModelProperty("类型id")
@Column(name = "type_id")
private Integer typeId;
private String typeId;
@ApiModelProperty("商品类型 1--房车;2--机车;3--游艇")
@Column(name = "goods_type")
private Integer goodsType;
@ApiModelProperty("类型id名称")
@Column(name = "name")
......
......@@ -9,19 +9,22 @@ import com.github.wxiaoqi.security.admin.entity.AppUserCollect;
import com.github.wxiaoqi.security.admin.mapper.AppUserCollectMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.BeanUtils;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.campsite.entity.CampsiteShop;
import com.xxfc.platform.campsite.feign.CampsiteFeign;
import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.feign.TourFeign;
import org.apache.commons.beanutils.BeanUtils;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
import java.util.Objects;
/**
* ${DESCRIPTION}
......@@ -36,13 +39,19 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl
@Autowired
TourFeign tourFeign;
@Autowired
VehicleFeign vehicleFeign;
@Autowired
CampsiteFeign campsiteFeign;
//新增收藏
public ObjectRestResponse addUserCollect(AppUserCollectDTO collectDTO)throws Exception{
Integer typeId=collectDTO.getTypeId();
Integer type=collectDTO.getType();
if(collectDTO==null||typeId==null||type==null){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
String typeId = collectDTO.getTypeId();
Integer type = collectDTO.getType() == null ? 0 : collectDTO.getType();
if( StringUtils.isBlank(typeId) || type == 0 ){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数不能为空");
}
Example example = new Example(AppUserCollect.class);
Example.Criteria criteria = example.createCriteria();
......@@ -53,16 +62,33 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "已收藏!");
}
AppUserCollect collect=new AppUserCollect();
BeanUtils.copyProperties(collect,collectDTO);
TourGood tourGood=tourFeign.one(typeId);
BeanUtils.copyProperties(collectDTO,collect);
if ( type == 1){
ObjectRestResponse<Vehicle> restResponse = vehicleFeign.get(typeId);
if (restResponse.getData() == null){
return restResponse;
}
Vehicle vehicle = restResponse.getData();
vehicle.setId(null);
BeanUtils.copyPropertiesTargetIsNull(vehicle,collect);
collect.setUnit(vehicle.getPriceType() == 1 ? "天" : "小时");
}else if ( type == 2){
TourGood tourGood=tourFeign.one(Integer.parseInt(typeId));
if(tourGood!=null){
BeanUtils.copyProperties(collect,tourGood);
BeanUtils.copyProperties(tourGood,collect);
}
}else if ( type == 3){
ObjectRestResponse<CampsiteShop> restResponse = campsiteFeign.shopId(Integer.parseInt(typeId));
if (restResponse.getData() == null){
return restResponse;
}
CampsiteShop campsiteShop = restResponse.getData();
BeanUtils.copyPropertiesTargetIsNull(campsiteShop,collect);
collect.setCover(campsiteShop.getLogo());
}
collect.setId(null);
collect.setStatus(0);
insertSelective(collect);
}
return ObjectRestResponse.succ();
}
......@@ -77,7 +103,7 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl
return ObjectRestResponse.succ();
}
//查看是否收藏
public ObjectRestResponse checkUserCollect(Integer id,Integer userId,Integer type){
public ObjectRestResponse checkUserCollect(String id,Integer userId,Integer type){
Example example = new Example(AppUserCollect.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId",userId).andEqualTo("typeId",id).
......@@ -107,7 +133,7 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl
}
public boolean isCollectionByTypeAndTypeId(Integer userId,int type, Integer typeId) {
public boolean isCollectionByTypeAndTypeId(Integer userId,int type, String typeId) {
AppUserCollect appUserCollect = new AppUserCollect();
appUserCollect.setType(type);
appUserCollect.setTypeId(typeId);
......
package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.AppUserBiz;
import com.github.wxiaoqi.security.admin.biz.AppUserCollectBiz;
import com.github.wxiaoqi.security.admin.biz.AppUserDetailBiz;
import com.github.wxiaoqi.security.admin.dto.AppUserCollectDTO;
import com.github.wxiaoqi.security.admin.entity.AppUser;
import com.github.wxiaoqi.security.admin.entity.Group;
import com.github.wxiaoqi.security.admin.entity.User;
import com.github.wxiaoqi.security.admin.vo.AppUserGroups;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.tour.feign.TourFeign;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @author keliii
......@@ -87,7 +75,7 @@ public class AppUserCollectController extends CommonBaseController {
@RequestMapping(value = "/collect",method = RequestMethod.GET)
@ApiModelProperty("查看是否收藏")
public ObjectRestResponse<AppUser> get(
@RequestParam(value = "id",defaultValue = "0")Integer id,
@RequestParam(value = "id",defaultValue = "")String id,
@RequestParam(value = "type",defaultValue = "0")Integer type
)throws Exception{
String username = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId();
......@@ -113,7 +101,7 @@ public class AppUserCollectController extends CommonBaseController {
@ApiOperation("判断是否收藏")
public boolean isCollectionByTypeAndTypeId(@RequestParam("userId") Integer userId,
@RequestParam(value = "type") int type,
@RequestParam("id") Integer typId){
@RequestParam("id") String typId){
return collectBiz.isCollectionByTypeAndTypeId(userId,type,typId);
}
}
......@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.sun.org.apache.regexp.internal.RE;
import com.xxfc.platform.campsite.dto.CampsiteShopFindDTO;
import com.xxfc.platform.campsite.entity.CampsiteShop;
import com.xxfc.platform.campsite.vo.CampsiteShopDetailVo;
import com.xxfc.platform.campsite.vo.CampsiteShopPageVo;
import io.swagger.annotations.ApiOperation;
......@@ -52,4 +53,8 @@ public interface CampsiteFeign {
@PostMapping(value = "/app/unauth/campsites")
ObjectRestResponse<PageDataVO<CampsiteShopPageVo>> findCampsiteShopPageForUncc(@RequestBody CampsiteShopFindDTO campsiteShopFindDTO);
@ApiOperation("查询营地")
@GetMapping("/app/unauth/shopId")
ObjectRestResponse<CampsiteShop> shopId(@RequestParam(value = "id") Integer id);
}
package com.xxfc.platform.campsite.rest;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
......@@ -84,4 +85,12 @@ public class CampsiteShopController extends BaseController<CampsiteShopBiz, Camp
return ObjectRestResponse.succ(campsiteShops);
}
@ApiOperation("查询营地")
@GetMapping("/app/unauth/shopId")
@IgnoreUserToken
public ObjectRestResponse<CampsiteShop> shopId(@RequestParam(value = "id") Integer id) {
return ObjectRestResponse.succ(baseBiz.selectById(id));
}
}
\ No newline at end of file
......@@ -24,6 +24,9 @@ public class VehicleExtensionVO extends VehicleExtension {
@ApiModelProperty("父级是否选中:0-未;1-是")
private Integer isParentSelected;
@ApiModelProperty("客户是否多选:0-否,1-是")
private Integer isMore;
public List<VehicleExtensionVO> children;
}
\ No newline at end of file
......@@ -86,6 +86,7 @@
SELECT
c.id,
c.`name` as cataName,
c.`is_more` as isMore,
<choose>
<when test="vehicleId != null and vehicleId != ''">
IF(e.cata_id is NULL,0,1) as isSelected,
......
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