|
@@ -512,20 +512,32 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
public Boolean editPack(AppSitePlaceParkDTO appSitePlaceParkDTO) {
|
|
|
AppSitePlaceCuDTO placeCuDTO = appSitePlaceParkDTO.getAppSitePlaceCuDTO();
|
|
|
List<AppSiteCategoryRuleDTO> appSiteCategoryRuleDTOS = appSitePlaceParkDTO.getAppSiteCategoryRuleDTOS();
|
|
|
-
|
|
|
AppSite site = appSiteMapper.selectById(placeCuDTO.getSiteId());
|
|
|
if (site == null) {
|
|
|
throw new JeecgBootException("商户门店不存在", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
}
|
|
|
// 查询当前场地的所有包场场所
|
|
|
- List<AppSitePlace> existingPlaces = baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getSiteId, site.getId()).eq(AppSitePlace::getType, SitePlaceTypeEnum.PACKAGE.getCode()));
|
|
|
+ List<AppSitePlace> existingPlaces = baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
|
|
|
+ .eq(AppSitePlace::getSiteId, site.getId())
|
|
|
+ .eq(AppSitePlace::getType, SitePlaceTypeEnum.PACKAGE.getCode()));
|
|
|
if (existingPlaces.isEmpty()) {
|
|
|
// 无须对比直接做新增
|
|
|
return savePack(appSitePlaceParkDTO);
|
|
|
}
|
|
|
-
|
|
|
// 对比修改
|
|
|
for (AppSiteCategoryRuleDTO appSiteCategoryRuleDTO : appSiteCategoryRuleDTOS) {
|
|
|
+ // 收集所有新的分类ID
|
|
|
+ Set<String> newCategoryIds = appSiteCategoryRuleDTOS.stream()
|
|
|
+ .map(AppSiteCategoryRuleDTO::getCategoryId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ // 删除不在新分类列表中的现有场地
|
|
|
+ existingPlaces.forEach(place -> {
|
|
|
+ if (!newCategoryIds.contains(place.getCategoryId())) {
|
|
|
+ baseMapper.deleteById(place);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
String categoryId = appSiteCategoryRuleDTO.getCategoryId();
|
|
|
Integer count = appSiteCategoryRuleDTO.getCount();
|
|
|
|
|
@@ -897,6 +909,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
schoolPlaceAddDTO
|
|
|
.setSiteId(site.getId())
|
|
|
.setSiteId(appSitePlace.getId())
|
|
|
+ .setPlaceId(appSitePlace.getId())
|
|
|
.setInsureIds(appSitePlace.getInsureIds())
|
|
|
.setReminder(appSitePlace.getReminder());
|
|
|
if (ObjectUtil.isNotEmpty(appSitePlace.getCover())) {
|
|
@@ -916,7 +929,9 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
public AppSitePlaceParkDTO queryPack(String siteId) {
|
|
|
AppSitePlaceParkDTO appSitePlaceParkDTO = new AppSitePlaceParkDTO();
|
|
|
AppSite site = appSiteMapper.selectById(siteId);
|
|
|
- List<AppSitePlace> appSitePlaceList = this.baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getSiteId, site.getId()).eq(AppSitePlace::getType, SitePlaceTypeEnum.PACKAGE.getCode()));
|
|
|
+ List<AppSitePlace> appSitePlaceList = this.baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery()
|
|
|
+ .eq(AppSitePlace::getSiteId, site.getId())
|
|
|
+ .eq(AppSitePlace::getType, SitePlaceTypeEnum.PACKAGE.getCode()));
|
|
|
if (ObjectUtils.isNotEmpty(appSitePlaceList)) {
|
|
|
List<AppSiteCategoryRuleDTO> appSiteCategoryRuleDTOS = new ArrayList<>();
|
|
|
if (CollUtil.isNotEmpty(appSitePlaceList)) {
|