|
@@ -1,8 +1,13 @@
|
|
|
package org.jeecg.modules.rooms.service;
|
|
package org.jeecg.modules.rooms.service;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
|
|
+import org.jeecg.modules.business.entity.BusMarketMember;
|
|
|
|
|
+import org.jeecg.modules.business.service.impl.BusMarketMemberServiceImpl;
|
|
|
|
|
+import org.jeecg.modules.rooms.Vo.LayoutMemberPriceVo;
|
|
|
import org.jeecg.modules.rooms.entity.CesRoomLayoutMemberPrice;
|
|
import org.jeecg.modules.rooms.entity.CesRoomLayoutMemberPrice;
|
|
|
import org.jeecg.modules.rooms.mapper.CesRoomLayoutMemberPriceMapper;
|
|
import org.jeecg.modules.rooms.mapper.CesRoomLayoutMemberPriceMapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -11,6 +16,8 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Optional;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <p>
|
|
* <p>
|
|
@@ -26,14 +33,43 @@ public class CesRoomLayoutMemberPriceServiceImpl extends ServiceImpl<CesRoomLayo
|
|
|
@Resource
|
|
@Resource
|
|
|
private CesRoomLayoutMemberPriceMapper cesRoomLayoutMemberPriceMapper;
|
|
private CesRoomLayoutMemberPriceMapper cesRoomLayoutMemberPriceMapper;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private BusMarketMemberServiceImpl marketMemberService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
public List<CesRoomLayoutMemberPrice> getListByParentId(String parentId){
|
|
public List<CesRoomLayoutMemberPrice> getListByParentId(String parentId){
|
|
|
if(StringUtils.isBlank(parentId)) return new ArrayList<>();
|
|
if(StringUtils.isBlank(parentId)) return new ArrayList<>();
|
|
|
List<CesRoomLayoutMemberPrice> list = cesRoomLayoutMemberPriceMapper.selectList(Wrappers.<CesRoomLayoutMemberPrice>lambdaQuery()
|
|
List<CesRoomLayoutMemberPrice> list = cesRoomLayoutMemberPriceMapper.selectList(Wrappers.<CesRoomLayoutMemberPrice>lambdaQuery()
|
|
|
.eq(CesRoomLayoutMemberPrice::getParentId,parentId)
|
|
.eq(CesRoomLayoutMemberPrice::getParentId,parentId)
|
|
|
.eq(CesRoomLayoutMemberPrice::getInvalid,false));
|
|
.eq(CesRoomLayoutMemberPrice::getInvalid,false));
|
|
|
|
|
+
|
|
|
return list;
|
|
return list;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取会员等级数据
|
|
|
|
|
+ * @param parentId
|
|
|
|
|
+ * @param hotelId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public Result getListByHotelIdAndParentId(String parentId,String hotelId){
|
|
|
|
|
+ List<CesRoomLayoutMemberPrice> list = cesRoomLayoutMemberPriceMapper.selectList(Wrappers.<CesRoomLayoutMemberPrice>lambdaQuery()
|
|
|
|
|
+ .eq(CesRoomLayoutMemberPrice::getParentId,parentId)
|
|
|
|
|
+ .eq(CesRoomLayoutMemberPrice::getHotelId,hotelId)
|
|
|
|
|
+ .eq(CesRoomLayoutMemberPrice::getInvalid,false));
|
|
|
|
|
+ List<String> memberIds = list.stream().map(v -> v.getId()).collect(Collectors.toList());
|
|
|
|
|
+ List<BusMarketMember> marketMembers = marketMemberService.getByIds(memberIds,hotelId);
|
|
|
|
|
+ List<LayoutMemberPriceVo> vos = new ArrayList<>();
|
|
|
|
|
+ list.forEach(v -> {
|
|
|
|
|
+ LayoutMemberPriceVo vo = new LayoutMemberPriceVo();
|
|
|
|
|
+ BeanUtil.copyProperties(v,vo);
|
|
|
|
|
+ Optional<BusMarketMember> marketMemberOptional = marketMembers.stream().filter(c -> c.getId().equals(v.getLevelId())).findFirst();
|
|
|
|
|
+ if(marketMemberOptional.isPresent()) vo.setMemberName(marketMemberOptional.get().getName());
|
|
|
|
|
+ vos.add(vo);
|
|
|
|
|
+ });
|
|
|
|
|
+ return Result.OK(vos);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|