Commit a247e241 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/dev-chw' into dev-chw

parents bf79cf8c 5b555442
......@@ -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,14 +39,20 @@ 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();
criteria.andEqualTo("userId",collectDTO.getUserId()).andEqualTo("typeId",typeId)
......@@ -52,18 +61,35 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl
if (count>0){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "已收藏!");
}
AppUserCollect collect=new AppUserCollect();
BeanUtils.copyProperties(collect,collectDTO);
TourGood tourGood=tourFeign.one(typeId);
if(tourGood!=null){
BeanUtils.copyProperties(collect,tourGood);
collect.setId(null);
collect.setStatus(0);
insertSelective(collect);
}
return ObjectRestResponse.succ();
AppUserCollect collect=new AppUserCollect();
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(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();
}
//更新收藏
......@@ -72,12 +98,12 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
AppUserCollect collect=new AppUserCollect();
BeanUtils.copyProperties(collect,collectDTO);
BeanUtils.copyProperties(collectDTO,collect);
updateSelectiveById(collect);
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();
......@@ -106,6 +94,7 @@ public class AppUserCollectController extends CommonBaseController {
@RequestMapping(value = "/collect/remove",method = RequestMethod.POST)
@ApiModelProperty("取消收藏")
public ObjectRestResponse remove(@RequestBody AppUserCollectDTO collectDTO)throws Exception {
collectDTO.setStatus(1);
return collectBiz.upUserCollect(collectDTO);
}
......@@ -113,7 +102,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
......@@ -1626,6 +1626,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
vehicle.setManageCompanyId(vehicleApply.getSubordinateBranch());
insertSelective(vehicle);
vehicleId=vehicle.getId();
vehicleBookInfoBiz.addVehicleBookInfo(vehicleId);
setGoodsTypes(vehicle);
}
......
package com.xxfc.platform.vehicle.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.google.common.collect.Maps;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.vehicle.entity.VehicleBookInfo;
import com.xxfc.platform.vehicle.mapper.VehicleBookInfoMapper;
......@@ -15,7 +18,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
......@@ -34,6 +37,13 @@ public class VehicleBookInfoBiz extends BaseBiz<VehicleBookInfoMapper, VehicleBo
@Autowired
private RedisTemplate customRedisTemplate;
@Autowired
ThirdFeign thirdFeign;
private static final String DIC_VEHICLE_TYPE="VEHICLE";
private static final String DIC_VEHICLE_CODE="VEHICLE_JOB";
/**
* 迁移数据到历史表
* 每年一张表
......@@ -136,4 +146,24 @@ public class VehicleBookInfoBiz extends BaseBiz<VehicleBookInfoMapper, VehicleBo
public int update(VehicleBookInfo vehicleBookInfo) {
return mapper.updateById(vehicleBookInfo);
}
public void addVehicleBookInfo(String vehicleId) {
Dictionary dictionary = thirdFeign.findDictionaryByTypeAndCode(DIC_VEHICLE_TYPE, DIC_VEHICLE_CODE);
Integer months = Integer.valueOf(dictionary.getDetail());
LocalDate date = LocalDate.now();
for (int i = 0; i <= months; i++) {
if (i > 0){
date = date.plusMonths(i);
}
int year = date.getYear();
int month = date.getMonthValue();
String yearAndMonth = String.format("%d-%02d", year, month);
VehicleBookInfo vehicleBookInfo = new VehicleBookInfo();
vehicleBookInfo.setVehicle(vehicleId);
vehicleBookInfo.setYearMonth(yearAndMonth);
insertSelective(vehicleBookInfo);
}
}
}
......@@ -59,6 +59,7 @@
LEFT JOIN vehicle_category c ON v.category_id=c.id
LEFT JOIN branch_company i on v.subordinate_branch=i.id
<where>
v.is_del = 0
<if test="dataCompanyIds != null and dataCompanyIds.size > 0">
and i.id in
<foreach collection="dataCompanyIds" item="id" open="(" separator="," close=")">
......
......@@ -78,6 +78,7 @@
<foreach collection="cataIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
and c1.state = 0
GROUP BY c.parent_id
ORDER BY c1.id
</select>
......@@ -86,6 +87,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,
......@@ -123,6 +125,7 @@
) c2 ON c.id=c2.id
</if>
<where>
c.state = 0
<if test="parentId != null ">
and c.parent_id=#{parentId}
</if>
......
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