|
@@ -1,33 +1,33 @@
|
|
|
package org.dromara.hotel.service.impl;
|
|
package org.dromara.hotel.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import org.dromara.common.core.constant.HotelBusinessConstants;
|
|
import org.dromara.common.core.constant.HotelBusinessConstants;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
-import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
import org.dromara.hotel.domain.KfGuest;
|
|
import org.dromara.hotel.domain.KfGuest;
|
|
|
import org.dromara.hotel.domain.KfGuestTeamR;
|
|
import org.dromara.hotel.domain.KfGuestTeamR;
|
|
|
|
|
+import org.dromara.hotel.domain.KfTeam;
|
|
|
import org.dromara.hotel.domain.bo.KfGuestBo;
|
|
import org.dromara.hotel.domain.bo.KfGuestBo;
|
|
|
-import org.dromara.hotel.mapper.KfGuestMapper;
|
|
|
|
|
-import org.dromara.hotel.mapper.KfGuestTeamRMapper;
|
|
|
|
|
-import org.dromara.hotel.service.IKfGuestService;
|
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
|
import org.dromara.hotel.domain.bo.KfTeamBo;
|
|
import org.dromara.hotel.domain.bo.KfTeamBo;
|
|
|
import org.dromara.hotel.domain.vo.KfTeamVo;
|
|
import org.dromara.hotel.domain.vo.KfTeamVo;
|
|
|
-import org.dromara.hotel.domain.KfTeam;
|
|
|
|
|
|
|
+import org.dromara.hotel.mapper.KfGuestMapper;
|
|
|
|
|
+import org.dromara.hotel.mapper.KfGuestTeamRMapper;
|
|
|
import org.dromara.hotel.mapper.KfTeamMapper;
|
|
import org.dromara.hotel.mapper.KfTeamMapper;
|
|
|
import org.dromara.hotel.service.IKfTeamService;
|
|
import org.dromara.hotel.service.IKfTeamService;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import java.util.Collection;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
-import java.util.Collection;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 客团信息Service业务层处理
|
|
* 客团信息Service业务层处理
|
|
@@ -50,7 +50,7 @@ public class KfTeamServiceImpl implements IKfTeamService {
|
|
|
* @return 客团信息
|
|
* @return 客团信息
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public KfTeamVo queryById(Long id){
|
|
|
|
|
|
|
+ public KfTeamVo queryById(Long id) {
|
|
|
return baseMapper.selectVoById(id);
|
|
return baseMapper.selectVoById(id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -92,17 +92,17 @@ public class KfTeamServiceImpl implements IKfTeamService {
|
|
|
return lqw;
|
|
return lqw;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private QueryWrapper<KfTeam> buildQueryWrapper(KfTeamBo bo,String tableAlias) {
|
|
|
|
|
|
|
+ private QueryWrapper<KfTeam> buildQueryWrapper(KfTeamBo bo, String tableAlias) {
|
|
|
QueryWrapper<KfTeam> lqw = new QueryWrapper<>();
|
|
QueryWrapper<KfTeam> lqw = new QueryWrapper<>();
|
|
|
String columnPrefix = "";
|
|
String columnPrefix = "";
|
|
|
- if(StringUtils.isNotBlank(tableAlias)){
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(tableAlias)) {
|
|
|
columnPrefix = tableAlias + ".";
|
|
columnPrefix = tableAlias + ".";
|
|
|
}
|
|
}
|
|
|
- lqw.like(StringUtils.isNotBlank(bo.getName()), columnPrefix+"name", bo.getName());
|
|
|
|
|
- lqw.eq(bo.getStartTime() != null, columnPrefix+"start_time", bo.getStartTime());
|
|
|
|
|
- lqw.eq(bo.getEndTime() != null, columnPrefix+"end_time", bo.getEndTime());
|
|
|
|
|
- lqw.eq(bo.getPlanQuantity() != null, columnPrefix+"plan_quantity", bo.getPlanQuantity());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getOtherId()), columnPrefix+"other_id", bo.getOtherId());
|
|
|
|
|
|
|
+ lqw.like(StringUtils.isNotBlank(bo.getName()), columnPrefix + "name", bo.getName());
|
|
|
|
|
+ lqw.eq(bo.getStartTime() != null, columnPrefix + "start_time", bo.getStartTime());
|
|
|
|
|
+ lqw.eq(bo.getEndTime() != null, columnPrefix + "end_time", bo.getEndTime());
|
|
|
|
|
+ lqw.eq(bo.getPlanQuantity() != null, columnPrefix + "plan_quantity", bo.getPlanQuantity());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getOtherId()), columnPrefix + "other_id", bo.getOtherId());
|
|
|
return lqw;
|
|
return lqw;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -123,11 +123,11 @@ public class KfTeamServiceImpl implements IKfTeamService {
|
|
|
bo.setId(add.getId());
|
|
bo.setId(add.getId());
|
|
|
//2.新增客人信息
|
|
//2.新增客人信息
|
|
|
List<KfGuestBo> guestBoList = bo.getGuestList();
|
|
List<KfGuestBo> guestBoList = bo.getGuestList();
|
|
|
- if(guestBoList != null && guestBoList.size() > 0){
|
|
|
|
|
|
|
+ if (guestBoList != null && guestBoList.size() > 0) {
|
|
|
List<Long> guestIdList =
|
|
List<Long> guestIdList =
|
|
|
new java.util.ArrayList<>(guestBoList.stream().filter(item -> item.getId() != null).map(item -> item.getId()).toList());
|
|
new java.util.ArrayList<>(guestBoList.stream().filter(item -> item.getId() != null).map(item -> item.getId()).toList());
|
|
|
List<KfGuestBo> noIdBoList = guestBoList.stream().filter(item -> item.getId() == null).toList();
|
|
List<KfGuestBo> noIdBoList = guestBoList.stream().filter(item -> item.getId() == null).toList();
|
|
|
- if(noIdBoList != null && noIdBoList.size() > 0){
|
|
|
|
|
|
|
+ if (noIdBoList != null && noIdBoList.size() > 0) {
|
|
|
Collection<KfGuest> noIdList = MapstructUtils.convert(noIdBoList, KfGuest.class);
|
|
Collection<KfGuest> noIdList = MapstructUtils.convert(noIdBoList, KfGuest.class);
|
|
|
guestMapper.insertBatch(noIdList);
|
|
guestMapper.insertBatch(noIdList);
|
|
|
guestIdList.addAll(noIdList.stream().map(KfGuest::getId).toList());
|
|
guestIdList.addAll(noIdList.stream().map(KfGuest::getId).toList());
|
|
@@ -165,11 +165,11 @@ public class KfTeamServiceImpl implements IKfTeamService {
|
|
|
List<KfGuestBo> newGuests =
|
|
List<KfGuestBo> newGuests =
|
|
|
bo.getGuestList().stream().filter(item -> !dbGuestIds.contains(item.getId())).toList();
|
|
bo.getGuestList().stream().filter(item -> !dbGuestIds.contains(item.getId())).toList();
|
|
|
//3.处理新的客人
|
|
//3.处理新的客人
|
|
|
- if(newGuests.size() > 0){
|
|
|
|
|
|
|
+ if (newGuests.size() > 0) {
|
|
|
List<Long> guestIdList =
|
|
List<Long> guestIdList =
|
|
|
newGuests.stream().filter(item -> item.getId() != null).map(item -> item.getId()).toList();
|
|
newGuests.stream().filter(item -> item.getId() != null).map(item -> item.getId()).toList();
|
|
|
List<KfGuestBo> noIdBoList = newGuests.stream().filter(item -> item.getId() == null).toList();
|
|
List<KfGuestBo> noIdBoList = newGuests.stream().filter(item -> item.getId() == null).toList();
|
|
|
- if(noIdBoList != null && noIdBoList.size() > 0){
|
|
|
|
|
|
|
+ if (noIdBoList != null && noIdBoList.size() > 0) {
|
|
|
Collection<KfGuest> noIdList = MapstructUtils.convert(noIdBoList, KfGuest.class);
|
|
Collection<KfGuest> noIdList = MapstructUtils.convert(noIdBoList, KfGuest.class);
|
|
|
guestMapper.insertBatch(noIdList);
|
|
guestMapper.insertBatch(noIdList);
|
|
|
noIdList.stream().forEach(item -> guestIdList.add(item.getId()));
|
|
noIdList.stream().forEach(item -> guestIdList.add(item.getId()));
|
|
@@ -190,7 +190,7 @@ public class KfTeamServiceImpl implements IKfTeamService {
|
|
|
/**
|
|
/**
|
|
|
* 保存前的数据校验
|
|
* 保存前的数据校验
|
|
|
*/
|
|
*/
|
|
|
- private void validEntityBeforeSave(KfTeam entity){
|
|
|
|
|
|
|
+ private void validEntityBeforeSave(KfTeam entity) {
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -203,14 +203,15 @@ public class KfTeamServiceImpl implements IKfTeamService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
- if(isValid){
|
|
|
|
|
- //TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //if (isValid) {
|
|
|
|
|
+ // //TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
|
+ //}
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询团客信息
|
|
* 查询团客信息
|
|
|
|
|
+ *
|
|
|
* @param bo 团客业务对象
|
|
* @param bo 团客业务对象
|
|
|
* @return 团客信息
|
|
* @return 团客信息
|
|
|
*/
|
|
*/
|
|
@@ -226,4 +227,30 @@ public class KfTeamServiceImpl implements IKfTeamService {
|
|
|
return baseMapper.selectVoList(new LambdaQueryWrapper<KfTeam>()
|
|
return baseMapper.selectVoList(new LambdaQueryWrapper<KfTeam>()
|
|
|
.le(KfTeam::getStartTime, doingDate).ge(KfTeam::getEndTime, doingDate));
|
|
.le(KfTeam::getStartTime, doingDate).ge(KfTeam::getEndTime, doingDate));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean deleteWithOtherIds(Collection<String> otherIds, Long operatorId) {
|
|
|
|
|
+ LambdaUpdateWrapper<KfTeam> luw = new LambdaUpdateWrapper<>();
|
|
|
|
|
+ luw.set(KfTeam::getDelFlag, "2");
|
|
|
|
|
+ luw.set(KfTeam::getUpdateBy, operatorId);
|
|
|
|
|
+ luw.in(KfTeam::getOtherId, otherIds);
|
|
|
|
|
+ return baseMapper.update(null, luw) > 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean deleteWithOtherId(String otherId, Long operatorId) {
|
|
|
|
|
+ LambdaUpdateWrapper<KfTeam> luw = new LambdaUpdateWrapper<>();
|
|
|
|
|
+ luw.set(KfTeam::getDelFlag, "2");
|
|
|
|
|
+ luw.set(KfTeam::getUpdateBy, operatorId);
|
|
|
|
|
+ luw.eq(KfTeam::getOtherId, otherId);
|
|
|
|
|
+ return baseMapper.update(null, luw) > 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean deleteWithOtherId(String otherId) {
|
|
|
|
|
+ LambdaUpdateWrapper<KfTeam> luw = new LambdaUpdateWrapper<>();
|
|
|
|
|
+ luw.set(KfTeam::getDelFlag, "2");
|
|
|
|
|
+ luw.in(KfTeam::getOtherId, otherId);
|
|
|
|
|
+ return baseMapper.update(null, luw) > 0;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|