|
@@ -47,6 +47,8 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
private AppSiteMapper appSiteMapper;
|
|
|
@Resource
|
|
|
private AppCategoryMapper appCategoryMapper;
|
|
|
+ @Resource
|
|
|
+ private AppSiteRuleTimeMapper appSiteRuleTimeMapper;
|
|
|
|
|
|
//学校 一对多
|
|
|
|
|
@@ -285,7 +287,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
appSitePlace.setTenantId(site.getTenantId());
|
|
|
int updateById = baseMapper.updateById(appSitePlace);
|
|
|
if (updateById < 1) throw new JeecgBootException("无固定场编辑失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
- //查询无固定场价格表对应数据,查询对应数据修改
|
|
|
+ //查询无固定场价格表对应数据,查询对应数据修改
|
|
|
List<AppSitePriceRules> appSitePriceRulesList = appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, unsetDTO.getId()));
|
|
|
String[] split = unsetDTO.getDownTime().split(",");
|
|
|
List<String> downTimes = Arrays.stream(split).collect(Collectors.toList());
|
|
@@ -317,7 +319,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
if (deleteById < 1) throw new JeecgBootException("无固定场删除失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
int deleteById1 = appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, id));
|
|
|
if (deleteById1 < 1) throw new JeecgBootException("固定场价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
- return null;
|
|
|
+ return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -327,8 +329,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
LambdaQueryWrapper<AppSitePlace> wrapper = Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getType, SitePlaceTypeEnum.UNFIXED.getCode())
|
|
|
// .eq(AppSitePlace::getSiteId, dto.getSiteId())
|
|
|
.eq(AppSitePlace::getOrgCode, loginUser.getOrgCode())
|
|
|
- .like(StringUtils.isNotBlank(dto.getName()), AppSitePlace::getName, dto.getName())
|
|
|
- ;
|
|
|
+ .like(StringUtils.isNotBlank(dto.getName()), AppSitePlace::getName, dto.getName());
|
|
|
|
|
|
IPage<AppSitePlace> resultPage = baseMapper.selectPage(page, wrapper);
|
|
|
return resultPage.convert(record -> {
|
|
@@ -360,71 +361,139 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
}
|
|
|
|
|
|
//包场
|
|
|
+// @Override
|
|
|
+// @Transactional(rollbackFor = Exception.class)
|
|
|
+// public Boolean savePack(AppSitePlaceDTO placeDTO) {
|
|
|
+// AppSitePlaceCuDTO placeCuDTO = placeDTO.getAppSitePlaceCuDTO();
|
|
|
+// List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
|
|
|
+// AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getTenantId,placeCuDTO.getSiteId()));
|
|
|
+
|
|
|
+ /// / AppSite site = appSiteMapper.selectById(placeCuDTO.getSiteId());
|
|
|
+// placeDTO.getSiteCategoryDOTS().forEach(item -> {
|
|
|
+// AppCategory category = appCategoryMapper.selectById(item.getCategoryId());
|
|
|
+// for (int i = 0; i < item.getCount(); i++) {
|
|
|
+// AppSitePlace appSitePlace = new AppSitePlace();
|
|
|
+// BeanUtils.copyProperties(placeCuDTO, appSitePlace);
|
|
|
+// appSitePlace.setType(SitePlaceTypeEnum.PACKAGE.getCode());
|
|
|
+// appSitePlace.setName(category.getName() + (i + 1));
|
|
|
+// appSitePlace.setSiteId(site.getId());
|
|
|
+// appSitePlace.setOrgCode(site.getOrgCode());
|
|
|
+// appSitePlace.setTenantId(site.getTenantId());
|
|
|
+// appSitePlace.setCategoryId(category.getId());
|
|
|
+// int insert = baseMapper.insert(appSitePlace);
|
|
|
+// if (insert < 1) throw new JeecgBootException("包场保存失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// siteRuleDTOS.stream().filter(rule -> rule.getCategoryId().equals(category.getId())).collect(Collectors.toList()).forEach(rule -> {
|
|
|
+// AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
|
|
|
+// BeanUtils.copyProperties(rule, appSitePriceRules);
|
|
|
+// appSitePriceRules.setSitePlaceId(appSitePlace.getId());
|
|
|
+// appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
|
|
|
+// appSitePriceRules.setTenantId(appSitePlace.getTenantId());
|
|
|
+//
|
|
|
+// String batchUUID = IdUtil.simpleUUID();
|
|
|
+// appSitePriceRules.setBatchuuid(batchUUID);
|
|
|
+// int savePriceResult = appSitePriceRulesMapper.insert(appSitePriceRules);
|
|
|
+// if (savePriceResult < 1)
|
|
|
+// throw new JeecgBootException("包场价格保存失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// });
|
|
|
+// }
|
|
|
+// });
|
|
|
+// return Boolean.TRUE;
|
|
|
+// }
|
|
|
+
|
|
|
+ //包场新增
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean savePack(AppSitePlaceDTO placeDTO) {
|
|
|
- AppSitePlaceCuDTO placeCuDTO = placeDTO.getAppSitePlaceCuDTO();
|
|
|
- List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
|
|
|
-// AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getTenantId,placeCuDTO.getSiteId()));
|
|
|
+ public Boolean savePack(AppSitePlaceParkDTO appSitePlaceParkDTO) {
|
|
|
+ AppSitePlaceCuDTO placeCuDTO = appSitePlaceParkDTO.getAppSitePlaceCuDTO();
|
|
|
+ List<AppSiteCategoryRuleDTO> appSiteCategoryRuleDTOS = appSitePlaceParkDTO.getAppSiteCategoryRuleDTOS();
|
|
|
AppSite site = appSiteMapper.selectById(placeCuDTO.getSiteId());
|
|
|
- placeDTO.getSiteCategoryDOTS().forEach(item -> {
|
|
|
+ appSiteCategoryRuleDTOS.forEach(item -> {
|
|
|
AppCategory category = appCategoryMapper.selectById(item.getCategoryId());
|
|
|
+
|
|
|
+ List<AppSiteRuleTimeFormDTO> appSiteRuleTimeFormDTOList = item.getAppSiteRuleTimeFormDTOList();
|
|
|
+ for (AppSiteRuleTimeFormDTO appSiteRuleTimeFormDTO : appSiteRuleTimeFormDTOList) {
|
|
|
+ AppSiteRuleTime appSiteRuleTime = new AppSiteRuleTime();
|
|
|
+ appSiteRuleTime.setSiteId(site.getId());
|
|
|
+ appSiteRuleTime.setCategoryId(category.getId());
|
|
|
+ appSiteRuleTime.setStartTime(appSiteRuleTimeFormDTO.getStartTime());
|
|
|
+ appSiteRuleTime.setEndTime(appSiteRuleTimeFormDTO.getEndTime());
|
|
|
+ appSiteRuleTimeMapper.insert(appSiteRuleTime);
|
|
|
+ List<AppSiteRuleDTO> appSiteRuleDTOList = appSiteRuleTimeFormDTO.getAppSiteRuleDTOList();
|
|
|
+ for (AppSiteRuleDTO appSiteRuleDTO : appSiteRuleDTOList) {
|
|
|
+ appSiteRuleDTO.setSiteRuleTimeId(appSiteRuleTime.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for (int i = 0; i < item.getCount(); i++) {
|
|
|
AppSitePlace appSitePlace = new AppSitePlace();
|
|
|
BeanUtils.copyProperties(placeCuDTO, appSitePlace);
|
|
|
appSitePlace.setType(SitePlaceTypeEnum.PACKAGE.getCode());
|
|
|
appSitePlace.setName(category.getName() + (i + 1));
|
|
|
+ appSitePlace.setSiteId(site.getId());
|
|
|
appSitePlace.setOrgCode(site.getOrgCode());
|
|
|
appSitePlace.setTenantId(site.getTenantId());
|
|
|
+ appSitePlace.setCategoryId(category.getId());
|
|
|
+ appSitePlace.setType(SitePlaceTypeEnum.PACKAGE.getCode());
|
|
|
int insert = baseMapper.insert(appSitePlace);
|
|
|
if (insert < 1) throw new JeecgBootException("包场保存失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
- siteRuleDTOS.stream().filter(rule -> rule.getCategoryId().equals(category.getId())).collect(Collectors.toList()).forEach(rule -> {
|
|
|
- AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
|
|
|
- BeanUtils.copyProperties(rule, appSitePriceRules);
|
|
|
- appSitePriceRules.setSitePlaceId(appSitePlace.getId());
|
|
|
- appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
|
|
|
- appSitePriceRules.setTenantId(appSitePlace.getTenantId());
|
|
|
- int savePriceResult = appSitePriceRulesMapper.insert(appSitePriceRules);
|
|
|
- if (savePriceResult < 1)
|
|
|
- throw new JeecgBootException("包场价格保存失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+
|
|
|
+ List<AppSitePriceRules> appSitePriceRulesList = new ArrayList<>();
|
|
|
+
|
|
|
+ item.getAppSiteRuleTimeFormDTOList().forEach(formDTO -> {
|
|
|
+ formDTO.getAppSiteRuleDTOList().forEach(ruleDTO -> {
|
|
|
+ System.out.println();
|
|
|
+ AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
|
|
|
+ BeanUtils.copyProperties(formDTO, appSitePriceRules);
|
|
|
+ appSitePriceRules.setSitePlaceId(appSitePlace.getId());
|
|
|
+ appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
|
|
|
+ appSitePriceRules.setTenantId(appSitePlace.getTenantId());
|
|
|
+ appSitePriceRules.setCategoryId(category.getId());
|
|
|
+ appSitePriceRules.setDayOfWeek(ruleDTO.getDayOfWeek());
|
|
|
+ appSitePriceRules.setSellingPrice(ruleDTO.getSellingPrice());
|
|
|
+ appSitePriceRules.setType(appSitePlace.getType());
|
|
|
+ appSitePriceRules.setSiteRuleTimeId(ruleDTO.getSiteRuleTimeId());
|
|
|
+ appSitePriceRules.setStatus(CommonConstant.STATUS_0_INT);
|
|
|
+ appSitePriceRules.setDelFlag(CommonConstant.STATUS_0_INT);
|
|
|
+ appSitePriceRulesList.add(appSitePriceRules);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ appSitePriceRulesList.forEach(appSitePriceRule -> {
|
|
|
+ System.out.println(appSitePriceRule.toString());
|
|
|
});
|
|
|
+ appSitePriceRulesMapper.insertList(appSitePriceRulesList);
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
+
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Boolean editPack(AppSitePlaceDTO placeDTO) {
|
|
|
- AppSitePlaceCuDTO placeCuDTO = placeDTO.getAppSitePlaceCuDTO();
|
|
|
- List<AppSiteCategoryDOT> siteCategoryDOTS = placeDTO.getSiteCategoryDOTS();
|
|
|
- List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
|
|
|
-
|
|
|
- // 按 categoryId 分组价格规则
|
|
|
- Map<String, List<AppSiteRuleDTO>> ruleMap = siteRuleDTOS.stream()
|
|
|
- .collect(Collectors.groupingBy(AppSiteRuleDTO::getCategoryId));
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ 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()));
|
|
|
-
|
|
|
if (existingPlaces.isEmpty()) {
|
|
|
- throw new JeecgBootException("包场数据不存在", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+ //无须对比直接做新增
|
|
|
+ return savePack(appSitePlaceParkDTO);
|
|
|
}
|
|
|
|
|
|
// 用于存储需要保留的场地ID
|
|
|
List<String> updatedPlaceIds = new ArrayList<>();
|
|
|
|
|
|
- // 更新或新增场地
|
|
|
- for (AppSiteCategoryDOT item : siteCategoryDOTS) {
|
|
|
- String categoryId = item.getCategoryId();
|
|
|
- int count = item.getCount();
|
|
|
+ //对比修改
|
|
|
+ for (AppSiteCategoryRuleDTO appSiteCategoryRuleDTO : appSiteCategoryRuleDTOS) {
|
|
|
+ String categoryId = appSiteCategoryRuleDTO.getCategoryId();
|
|
|
+ Integer count = appSiteCategoryRuleDTO.getCount();
|
|
|
+
|
|
|
// 查询该分类已有的场地
|
|
|
List<AppSitePlace> categoryPlaces = existingPlaces.stream()
|
|
|
.filter(p -> p.getCategoryId() != null && p.getCategoryId().equals(categoryId))
|
|
@@ -452,6 +521,8 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
appSitePlace.setCategoryId(categoryId);
|
|
|
}
|
|
|
|
|
|
+ updatedPlaceIds.add(appSitePlace.getId());
|
|
|
+
|
|
|
// 设置场地名称
|
|
|
appSitePlace.setName(category.getName() + (i + 1));
|
|
|
// 保存或更新场地
|
|
@@ -466,76 +537,148 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
throw new JeecgBootException("包场场地更新失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
}
|
|
|
}
|
|
|
- //传回的当前场地的包场价格规则
|
|
|
- List<AppSiteRuleDTO> rules = ruleMap.getOrDefault(categoryId, Collections.emptyList());
|
|
|
- // 当前场地 更新价格规则
|
|
|
- List<AppSitePriceRules> priceRules = rules.stream()
|
|
|
- .map(rule -> {
|
|
|
- AppSitePriceRules priceRule = new AppSitePriceRules();
|
|
|
- BeanUtils.copyProperties(rule, priceRule);
|
|
|
- priceRule.setSitePlaceId(appSitePlace.getId());
|
|
|
- priceRule.setOrgCode(site.getOrgCode());
|
|
|
- priceRule.setTenantId(site.getTenantId());
|
|
|
- return priceRule;
|
|
|
- })
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- // 获取数据库中已有的价格规则
|
|
|
- List<AppSitePriceRules> dbRules = appSitePriceRulesMapper.selectList(
|
|
|
- Wrappers.<AppSitePriceRules>lambdaQuery()
|
|
|
- .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
|
|
|
- );
|
|
|
-
|
|
|
- // 构建新旧规则的映射(以 startTime + endTime 作为唯一标识)
|
|
|
- Map<String, AppSitePriceRules> dbRuleMap = dbRules.stream()
|
|
|
- .collect(Collectors.toMap(
|
|
|
- rule -> rule.getStartTime() + "-" + rule.getEndTime(),
|
|
|
- rule -> rule));
|
|
|
-
|
|
|
- Map<String, AppSitePriceRules> newRuleMap = priceRules.stream()
|
|
|
- .collect(Collectors.toMap(
|
|
|
- rule -> rule.getStartTime() + "-" + rule.getEndTime(),
|
|
|
- rule -> rule));
|
|
|
-
|
|
|
- // 找出要删除的旧规则(存在于db,不存在于new)
|
|
|
- List<AppSitePriceRules> toDelete = dbRules.stream()
|
|
|
- .filter(rule -> !newRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- // 找出要新增的规则(存在于new,不存在于db)
|
|
|
- List<AppSitePriceRules> toAdd = priceRules.stream()
|
|
|
- .filter(rule -> !dbRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- // 找出需要更新的规则(存在交集且内容不同)
|
|
|
- List<AppSitePriceRules> toUpdate = priceRules.stream()
|
|
|
- .filter(rule -> dbRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
|
|
|
- .filter(rule -> {
|
|
|
- AppSitePriceRules dbRule = dbRuleMap.get(rule.getStartTime() + "-" + rule.getEndTime());
|
|
|
- return !rule.equals(dbRule); // 自定义 equals 或手动比较字段
|
|
|
- })
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- // 执行操作
|
|
|
- toDelete.forEach(rule -> {
|
|
|
- int deleteResult = appSitePriceRulesMapper.deleteById(rule.getId());
|
|
|
- if (deleteResult < 1)
|
|
|
- throw new JeecgBootException("包场价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
- });
|
|
|
|
|
|
- toAdd.forEach(rule -> {
|
|
|
- int insertResult = appSitePriceRulesMapper.insert(rule);
|
|
|
- if (insertResult < 1)
|
|
|
- throw new JeecgBootException("包场价格规则新增失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+ //定义存在于表单的数据
|
|
|
+ List<String> appSiteRuleTimeIds = new ArrayList<>();
|
|
|
+
|
|
|
+ //新增或修改
|
|
|
+ appSiteCategoryRuleDTO.getAppSiteRuleTimeFormDTOList().forEach(appSiteRuleTimeFormDTO -> {
|
|
|
+
|
|
|
+ //新增
|
|
|
+ if (ObjectUtils.isEmpty(appSiteRuleTimeFormDTO.getId())) {
|
|
|
+ AppSiteRuleTime appSiteRuleTime = new AppSiteRuleTime();
|
|
|
+ appSiteRuleTime.setSiteId(site.getId());
|
|
|
+ appSiteRuleTime.setCategoryId(category.getId());
|
|
|
+ appSiteRuleTime.setStartTime(appSiteRuleTimeFormDTO.getStartTime());
|
|
|
+ appSiteRuleTime.setEndTime(appSiteRuleTimeFormDTO.getEndTime());
|
|
|
+ appSiteRuleTimeMapper.insert(appSiteRuleTime);
|
|
|
+
|
|
|
+ appSiteRuleTimeFormDTO.getAppSiteRuleDTOList().forEach(rule -> {
|
|
|
+ AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
|
|
|
+ BeanUtils.copyProperties(rule, appSitePriceRules);
|
|
|
+ appSitePriceRules.setSitePlaceId(appSitePlace.getId());
|
|
|
+ appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
|
|
|
+ appSitePriceRules.setTenantId(appSitePlace.getTenantId());
|
|
|
+ appSitePriceRules.setSiteRuleTimeId(appSiteRuleTime.getId());
|
|
|
+ int savePriceResult = appSitePriceRulesMapper.insert(appSitePriceRules);
|
|
|
+ if (savePriceResult < 1)
|
|
|
+ throw new JeecgBootException("包场价格保存失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ appSiteRuleTimeIds.add(appSiteRuleTimeFormDTO.getId());
|
|
|
+ //修改
|
|
|
+ AppSiteRuleTime appSiteRuleTime = new AppSiteRuleTime();
|
|
|
+ appSiteRuleTime.setSiteId(site.getId());
|
|
|
+// appSiteRuleTime.setSitePlaceId(appSitePlace.getId());
|
|
|
+ appSiteRuleTime.setCategoryId(category.getId());
|
|
|
+ appSiteRuleTime.setStartTime(appSiteRuleTimeFormDTO.getStartTime());
|
|
|
+ appSiteRuleTime.setEndTime(appSiteRuleTimeFormDTO.getEndTime());
|
|
|
+ appSiteRuleTimeMapper.updateById(appSiteRuleTime);
|
|
|
+ appSiteRuleTimeFormDTO.getAppSiteRuleDTOList().forEach(rule -> {
|
|
|
+ AppSitePriceRules appSitePriceRules = new AppSitePriceRules();
|
|
|
+ BeanUtils.copyProperties(rule, appSitePriceRules);
|
|
|
+ appSitePriceRules.setSitePlaceId(appSitePlace.getId());
|
|
|
+ appSitePriceRules.setOrgCode(appSitePlace.getOrgCode());
|
|
|
+ appSitePriceRules.setTenantId(appSitePlace.getTenantId());
|
|
|
+ appSitePriceRules.setSiteRuleTimeId(appSiteRuleTime.getId());
|
|
|
+
|
|
|
+ int updateResult = appSitePriceRulesMapper.updateById(appSitePriceRules);
|
|
|
+ if (updateResult < 1)
|
|
|
+ throw new JeecgBootException("包场价格保存失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
- toUpdate.forEach(rule -> {
|
|
|
- int updateResult = appSitePriceRulesMapper.updateById(rule);
|
|
|
- if (updateResult < 1)
|
|
|
- throw new JeecgBootException("包场价格规则更新失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
- });
|
|
|
+ //删除
|
|
|
+ //查询本地所有的siteRuleTime
|
|
|
+ List<AppSiteRuleTime> appSiteRuleTimeList = appSiteRuleTimeMapper.selectList(Wrappers.<AppSiteRuleTime>lambdaQuery()
|
|
|
+ // .eq(AppSiteRuleTime::getSitePlaceId, appSitePlace.getId())
|
|
|
+ .eq(AppSiteRuleTime::getCategoryId, categoryId)
|
|
|
+ );
|
|
|
+ if(ObjectUtils.isEmpty(appSiteRuleTimeList)){
|
|
|
+ List<String> localIds = appSiteRuleTimeList.stream().map(AppSiteRuleTime::getId).collect(Collectors.toList());
|
|
|
+ // 找出要删除的旧规则(存在于db,不存在于new)
|
|
|
+ List<String> toDelete = getDifferListByMap(localIds, appSiteRuleTimeIds);
|
|
|
|
|
|
- updatedPlaceIds.add(appSitePlace.getId());
|
|
|
+ toDelete.forEach(id -> {
|
|
|
+ appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSiteRuleTimeId, id));
|
|
|
+ });
|
|
|
+ appSiteRuleTimeMapper.deleteBatchIds(toDelete);
|
|
|
+ }
|
|
|
+// //当前场地的包场价格规则
|
|
|
+// List<AppSiteRuleDTO> rules = appSiteCategoryRuleDTO.getAppSiteRuleDTOList();//表单数据
|
|
|
+// // 当前场地 更新价格规则
|
|
|
+// List<AppSitePriceRules> priceRules = rules.stream()
|
|
|
+// .map(rule -> {
|
|
|
+// AppSitePriceRules priceRule = new AppSitePriceRules();
|
|
|
+// BeanUtils.copyProperties(rule, priceRule);
|
|
|
+// priceRule.setSitePlaceId(appSitePlace.getId());
|
|
|
+// priceRule.setOrgCode(site.getOrgCode());
|
|
|
+// priceRule.setTenantId(site.getTenantId());
|
|
|
+// return priceRule;
|
|
|
+// })
|
|
|
+// .collect(Collectors.toList());//表单数据
|
|
|
+//
|
|
|
+// // 获取数据库中已有的价格规则
|
|
|
+// List<AppSitePriceRules> dbRules = appSitePriceRulesMapper.selectList(
|
|
|
+// Wrappers.<AppSitePriceRules>lambdaQuery()
|
|
|
+// .eq(AppSitePriceRules::getCategoryId, categoryId)
|
|
|
+// .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
|
|
|
+// );//本地数据,当前的场地的规则数据
|
|
|
+//
|
|
|
+// // 找出要新增的规则(存在于new,不存在于db)
|
|
|
+// List<AppSitePriceRules> toAdd = priceRules.stream()
|
|
|
+// .filter(rule -> rule.getId() == null)
|
|
|
+// .collect(Collectors.toList());
|
|
|
+// toAdd.forEach(rule -> {
|
|
|
+// int insertResult = appSitePriceRulesMapper.insert(rule);
|
|
|
+// if (insertResult < 1)
|
|
|
+// throw new JeecgBootException("包场价格规则新增失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// });
|
|
|
+//
|
|
|
+// // 找出需要更新的规则(存在ID的数据)
|
|
|
+// List<AppSitePriceRules> toUpdate = priceRules.stream()
|
|
|
+// .filter(rule -> rule.getId() != null)
|
|
|
+// .collect(Collectors.toList());
|
|
|
+//
|
|
|
+// //切换成当前场地的数据
|
|
|
+// for (AppSitePriceRules appSitePriceRules : toUpdate) {
|
|
|
+// AppSitePriceRules sitePriceRules = appSitePriceRulesMapper.selectOne(Wrappers.<AppSitePriceRules>lambdaQuery()
|
|
|
+// .eq(AppSitePriceRules::getCategoryId, categoryId)
|
|
|
+// .eq(AppSitePriceRules::getBatchuuid, appSitePriceRules.getBatchuuid())
|
|
|
+// .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId()));
|
|
|
+// appSitePriceRules.setId(sitePriceRules.getId());
|
|
|
+// }
|
|
|
+//
|
|
|
+// toUpdate.forEach(rule -> {
|
|
|
+// int updateResult = appSitePriceRulesMapper.updateById(rule);
|
|
|
+// if (updateResult < 1)
|
|
|
+// throw new JeecgBootException("包场价格规则更新失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// });
|
|
|
+
|
|
|
+ //过滤掉新增数据
|
|
|
+// List<String> filterIds = rules.stream().map(AppSiteRuleDTO::getId).filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
|
|
+// List<String> localIds = dbRules.stream().map(AppSitePriceRules::getId).collect(Collectors.toList());
|
|
|
+// // 找出要删除的旧规则(存在于db,不存在于new)
|
|
|
+// List<String> toDelete = getDifferListByMap(localIds, filterIds);
|
|
|
+//
|
|
|
+// List<AppSitePriceRules> toDeleteList = dbRules.stream().filter(rule -> toDelete.contains(rule.getId())).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// //切换成当前场地的数据
|
|
|
+// for (AppSitePriceRules appSitePriceRules : toDeleteList) {
|
|
|
+// AppSitePriceRules sitePriceRules = appSitePriceRulesMapper.selectOne(Wrappers.<AppSitePriceRules>lambdaQuery()
|
|
|
+// .eq(AppSitePriceRules::getCategoryId, categoryId)
|
|
|
+// .eq(AppSitePriceRules::getBatchuuid, appSitePriceRules.getBatchuuid())
|
|
|
+// .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId()));
|
|
|
+// appSitePriceRules.setId(sitePriceRules.getId());
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 执行操作
|
|
|
+// toDeleteList.forEach(rule -> {
|
|
|
+// int deleteResult = appSitePriceRulesMapper.deleteById(rule);
|
|
|
+// if (deleteResult < 1)
|
|
|
+// throw new JeecgBootException("包场价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -546,7 +689,10 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
if (deleteResult < 1) {
|
|
|
throw new JeecgBootException("包场场地删除失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
}
|
|
|
-
|
|
|
+ // 删除对应的时间规则
|
|
|
+ appSiteRuleTimeMapper.deleteById(Wrappers.<AppSiteRuleTime>lambdaQuery()
|
|
|
+// .eq(AppSiteRuleTime::getSitePlaceId, existingPlace.getId())
|
|
|
+ );
|
|
|
// 删除对应的价格规则
|
|
|
int delete = appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery()
|
|
|
.eq(AppSitePriceRules::getSitePlaceId, existingPlace.getId()));
|
|
@@ -555,10 +701,195 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|
|
|
+ public static List<String> getDifferListByMap(List<String> listA, List<String> listB) {
|
|
|
+ List<String> differList = new ArrayList<>();
|
|
|
+ Map<String, Integer> map = new HashMap<>();
|
|
|
+ for (String strA : listA) {
|
|
|
+ map.put(strA, 1);
|
|
|
+ }
|
|
|
+ for (String strB : listB) {
|
|
|
+ Integer value = map.get(strB);
|
|
|
+ if (value != null) {
|
|
|
+ map.put(strB, ++value);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ map.put(strB, 1);
|
|
|
+ }
|
|
|
+ for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
|
|
+ if (entry.getValue() == 1) {
|
|
|
+ differList.add(entry.getKey());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return differList;
|
|
|
+ }
|
|
|
+
|
|
|
+// @Override
|
|
|
+// public Boolean editPack(AppSitePlaceDTO placeDTO) {
|
|
|
+// AppSitePlaceCuDTO placeCuDTO = placeDTO.getAppSitePlaceCuDTO();
|
|
|
+// List<AppSiteCategoryDOT> siteCategoryDOTS = placeDTO.getSiteCategoryDOTS();
|
|
|
+// List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS();
|
|
|
+//
|
|
|
+// // 按 categoryId 分组价格规则
|
|
|
+// Map<String, List<AppSiteRuleDTO>> ruleMap = siteRuleDTOS.stream()
|
|
|
+// .collect(Collectors.groupingBy(AppSiteRuleDTO::getCategoryId));
|
|
|
+//
|
|
|
+// 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()));
|
|
|
+//
|
|
|
+// if (existingPlaces.isEmpty()) {
|
|
|
+// throw new JeecgBootException("包场数据不存在", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 用于存储需要保留的场地ID
|
|
|
+// List<String> updatedPlaceIds = new ArrayList<>();
|
|
|
+//
|
|
|
+// // 更新或新增场地
|
|
|
+// for (AppSiteCategoryDOT item : siteCategoryDOTS) {
|
|
|
+// String categoryId = item.getCategoryId();
|
|
|
+// int count = item.getCount();
|
|
|
+// // 查询该分类已有的场地
|
|
|
+// List<AppSitePlace> categoryPlaces = existingPlaces.stream()
|
|
|
+// .filter(p -> p.getCategoryId() != null && p.getCategoryId().equals(categoryId))
|
|
|
+// .sorted(Comparator.comparing(AppSitePlace::getName)) // 按名称排序以确保顺序一致
|
|
|
+// .collect(Collectors.toList());
|
|
|
+//
|
|
|
+// AppCategory category = appCategoryMapper.selectById(categoryId);
|
|
|
+// if (category == null) {
|
|
|
+// throw new JeecgBootException("分类不存在", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 扩展或裁剪场地数量
|
|
|
+// for (int i = 0; i < count; i++) {
|
|
|
+// AppSitePlace appSitePlace;
|
|
|
+// if (i < categoryPlaces.size()) {
|
|
|
+// // 更新现有场地
|
|
|
+// appSitePlace = categoryPlaces.get(i);
|
|
|
+// } else {
|
|
|
+// // 创建新场地
|
|
|
+// appSitePlace = new AppSitePlace();
|
|
|
+// BeanUtils.copyProperties(placeCuDTO, appSitePlace);
|
|
|
+// appSitePlace.setType(SitePlaceTypeEnum.PACKAGE.getCode());
|
|
|
+// appSitePlace.setOrgCode(site.getOrgCode());
|
|
|
+// appSitePlace.setTenantId(site.getTenantId());
|
|
|
+// appSitePlace.setCategoryId(categoryId);
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 设置场地名称
|
|
|
+// appSitePlace.setName(category.getName() + (i + 1));
|
|
|
+// // 保存或更新场地
|
|
|
+// if (appSitePlace.getId() == null) {
|
|
|
+// int insertResult = baseMapper.insert(appSitePlace);
|
|
|
+// if (insertResult < 1) {
|
|
|
+// throw new JeecgBootException("包场场地创建失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// int updateResult = baseMapper.updateById(appSitePlace);
|
|
|
+// if (updateResult < 1) {
|
|
|
+// throw new JeecgBootException("包场场地更新失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// //传回的当前场地的包场价格规则
|
|
|
+// List<AppSiteRuleDTO> rules = ruleMap.getOrDefault(categoryId, Collections.emptyList());
|
|
|
+// // 当前场地 更新价格规则
|
|
|
+// List<AppSitePriceRules> priceRules = rules.stream()
|
|
|
+// .map(rule -> {
|
|
|
+// AppSitePriceRules priceRule = new AppSitePriceRules();
|
|
|
+// BeanUtils.copyProperties(rule, priceRule);
|
|
|
+// priceRule.setSitePlaceId(appSitePlace.getId());
|
|
|
+// priceRule.setOrgCode(site.getOrgCode());
|
|
|
+// priceRule.setTenantId(site.getTenantId());
|
|
|
+// return priceRule;
|
|
|
+// })
|
|
|
+// .collect(Collectors.toList());
|
|
|
+//
|
|
|
+// // 获取数据库中已有的价格规则
|
|
|
+// List<AppSitePriceRules> dbRules = appSitePriceRulesMapper.selectList(
|
|
|
+// Wrappers.<AppSitePriceRules>lambdaQuery()
|
|
|
+// .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
|
|
|
+// );
|
|
|
+//
|
|
|
+// // 构建新旧规则的映射(以 startTime + endTime 作为唯一标识)
|
|
|
+// Map<String, AppSitePriceRules> dbRuleMap = dbRules.stream()
|
|
|
+// .collect(Collectors.toMap(
|
|
|
+// rule -> rule.getStartTime() + "-" + rule.getEndTime(),
|
|
|
+// rule -> rule));
|
|
|
+//
|
|
|
+// Map<String, AppSitePriceRules> newRuleMap = priceRules.stream()
|
|
|
+// .collect(Collectors.toMap(
|
|
|
+// rule -> rule.getStartTime() + "-" + rule.getEndTime(),
|
|
|
+// rule -> rule));
|
|
|
+//
|
|
|
+// // 找出要删除的旧规则(存在于db,不存在于new)
|
|
|
+// List<AppSitePriceRules> toDelete = dbRules.stream()
|
|
|
+// .filter(rule -> !newRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
|
|
|
+// .collect(Collectors.toList());
|
|
|
+//
|
|
|
+// // 找出要新增的规则(存在于new,不存在于db)
|
|
|
+// List<AppSitePriceRules> toAdd = priceRules.stream()
|
|
|
+// .filter(rule -> !dbRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
|
|
|
+// .collect(Collectors.toList());
|
|
|
+//
|
|
|
+// // 找出需要更新的规则(存在交集且内容不同)
|
|
|
+// List<AppSitePriceRules> toUpdate = priceRules.stream()
|
|
|
+// .filter(rule -> dbRuleMap.containsKey(rule.getStartTime() + "-" + rule.getEndTime()))
|
|
|
+// .filter(rule -> {
|
|
|
+// AppSitePriceRules dbRule = dbRuleMap.get(rule.getStartTime() + "-" + rule.getEndTime());
|
|
|
+// return !rule.equals(dbRule); // 自定义 equals 或手动比较字段
|
|
|
+// })
|
|
|
+// .collect(Collectors.toList());
|
|
|
+//
|
|
|
+// // 执行操作
|
|
|
+// toDelete.forEach(rule -> {
|
|
|
+// int deleteResult = appSitePriceRulesMapper.deleteById(rule.getId());
|
|
|
+// if (deleteResult < 1)
|
|
|
+// throw new JeecgBootException("包场价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// });
|
|
|
+//
|
|
|
+// toAdd.forEach(rule -> {
|
|
|
+// int insertResult = appSitePriceRulesMapper.insert(rule);
|
|
|
+// if (insertResult < 1)
|
|
|
+// throw new JeecgBootException("包场价格规则新增失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// });
|
|
|
+//
|
|
|
+// toUpdate.forEach(rule -> {
|
|
|
+// int updateResult = appSitePriceRulesMapper.updateById(rule);
|
|
|
+// if (updateResult < 1)
|
|
|
+// throw new JeecgBootException("包场价格规则更新失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// });
|
|
|
+//
|
|
|
+// updatedPlaceIds.add(appSitePlace.getId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 删除不再需要的场地
|
|
|
+// for (AppSitePlace existingPlace : existingPlaces) {
|
|
|
+// if (!updatedPlaceIds.contains(existingPlace.getId())) {
|
|
|
+// int deleteResult = baseMapper.deleteById(existingPlace.getId());
|
|
|
+// if (deleteResult < 1) {
|
|
|
+// throw new JeecgBootException("包场场地删除失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 删除对应的价格规则
|
|
|
+// int delete = appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery()
|
|
|
+// .eq(AppSitePriceRules::getSitePlaceId, existingPlace.getId()));
|
|
|
+// if (delete < 1) {
|
|
|
+// throw new JeecgBootException("包场价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return Boolean.TRUE;
|
|
|
+// }
|
|
|
+
|
|
|
@Override
|
|
|
public AppSitePlaceDTO queryPackById(String id) {
|
|
|
AppSitePlace dbPlace = baseMapper.selectById(id);
|
|
@@ -618,7 +949,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
|
|
|
int year = DateUtils.getYear();
|
|
|
|
|
|
- Map<String, List<String>> HolidayMap = HolidayUtil.getYearHoliday(String.valueOf(year));
|
|
|
+// Map<String, List<String>> HolidayMap = HolidayUtil.getYearHoliday(String.valueOf(year));
|
|
|
|
|
|
//当前日期
|
|
|
Date currDate = DateUtils.str2Date(DateUtils.now(), new SimpleDateFormat("yyyy-MM-dd"));
|
|
@@ -700,7 +1031,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
}
|
|
|
}
|
|
|
//存放开放时段列表(删除再新增)
|
|
|
- appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().gt(AppSitePriceRules::getDateOfSale,currDate).eq(AppSitePriceRules::getTenantId, site.getTenantId()));
|
|
|
+ appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().gt(AppSitePriceRules::getDateOfSale, currDate).eq(AppSitePriceRules::getTenantId, site.getTenantId()));
|
|
|
appSitePriceRulesMapper.insertList(appSitePriceRulesList);
|
|
|
|
|
|
appSiteMapper.updateById(site);
|
|
@@ -715,13 +1046,16 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public SchoolPlaceAddDTO querySchoolPlace(String orgCode) {
|
|
|
|
|
|
SchoolPlaceAddDTO schoolPlaceAddDTO = new SchoolPlaceAddDTO();
|
|
|
|
|
|
AppSite site = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode, orgCode));
|
|
|
|
|
|
- if (ObjectUtils.isEmpty(site)) {return null;}
|
|
|
+ if (ObjectUtils.isEmpty(site)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
AppSitePlace appSitePlace = this.baseMapper.selectOne(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getOrgCode, orgCode));
|
|
|
|
|
@@ -742,13 +1076,85 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App
|
|
|
.setReminder(appSitePlace.getReminder());
|
|
|
}
|
|
|
|
|
|
- if ("admin".equals(loginUser.getRoleCode())){
|
|
|
+ if ("admin".equals(loginUser.getRoleCode())) {
|
|
|
schoolPlaceAddDTO.setHavePermission(Boolean.TRUE);
|
|
|
}
|
|
|
|
|
|
return schoolPlaceAddDTO;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ 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()));
|
|
|
+ if (ObjectUtils.isNotEmpty(appSitePlaceList)) {
|
|
|
+ List<AppSiteCategoryRuleDTO> appSiteCategoryRuleDTOS = new ArrayList<>();
|
|
|
+ if (CollUtil.isNotEmpty(appSitePlaceList)) {
|
|
|
+ AppSitePlace appSitePlace = appSitePlaceList.get(0);
|
|
|
+ AppSitePlaceCuDTO placeCuDTO = new AppSitePlaceCuDTO();
|
|
|
+ BeanUtils.copyProperties(appSitePlace, placeCuDTO);
|
|
|
+ appSitePlaceParkDTO.setAppSitePlaceCuDTO(placeCuDTO);
|
|
|
+
|
|
|
+ Map<String, List<AppSitePlace>> map = appSitePlaceList.stream().collect(Collectors.groupingBy(AppSitePlace::getCategoryId));
|
|
|
+ for (String key : map.keySet()) {
|
|
|
+ List<AppSitePlace> placeList = map.get(key);
|
|
|
+ AppSiteCategoryRuleDTO appSiteCategoryRuleDTO = new AppSiteCategoryRuleDTO();
|
|
|
+ appSiteCategoryRuleDTO.setCategoryId(key);
|
|
|
+ appSiteCategoryRuleDTO.setCount(placeList.size());
|
|
|
+ //查询当前场地的规则时间列表
|
|
|
+ List<AppSiteRuleTime> appSiteRuleTimeList = appSiteRuleTimeMapper.selectList(Wrappers.<AppSiteRuleTime>lambdaQuery()
|
|
|
+ .eq(AppSiteRuleTime::getSiteId, site.getId())
|
|
|
+ .eq(AppSiteRuleTime::getCategoryId,key)
|
|
|
+ );
|
|
|
+ List<AppSiteRuleTimeFormDTO> formDTOList = new ArrayList<>();
|
|
|
+ if (ObjectUtils.isNotEmpty(appSiteRuleTimeList)) {
|
|
|
+ for (AppSiteRuleTime appSiteRuleTime : appSiteRuleTimeList) {
|
|
|
+ System.out.println("appsiteTimede id======================="+appSiteRuleTime.getId());
|
|
|
+ AppSiteRuleTimeFormDTO appSiteRuleTimeFormDTO = new AppSiteRuleTimeFormDTO();
|
|
|
+
|
|
|
+ appSiteRuleTimeFormDTO.setId(appSiteRuleTime.getId());
|
|
|
+ appSiteRuleTimeFormDTO.setStartTime(appSiteRuleTime.getStartTime());
|
|
|
+ appSiteRuleTimeFormDTO.setEndTime(appSiteRuleTime.getEndTime());
|
|
|
+
|
|
|
+ List<AppSiteRuleDTO> appSiteRuleDTOS = new ArrayList<>();
|
|
|
+
|
|
|
+ //todo 去除重的,根据星期,只取一条
|
|
|
+ List<AppSitePriceRules> appSitePriceRulesList = appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery()
|
|
|
+ .eq(AppSitePriceRules::getSiteRuleTimeId, appSiteRuleTime.getId())
|
|
|
+// .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())
|
|
|
+ );
|
|
|
+ System.out.println("appSitePriceRulesList的数量为++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"+appSitePriceRulesList.size());
|
|
|
+ if (ObjectUtils.isNotEmpty(appSitePriceRulesList)) {
|
|
|
+ for (AppSitePriceRules appSitePriceRules : appSitePriceRulesList) {
|
|
|
+ AppSiteRuleDTO appSiteRuleDTO = new AppSiteRuleDTO();
|
|
|
+ BeanUtils.copyProperties(appSitePriceRules, appSiteRuleDTO);
|
|
|
+ appSiteRuleDTOS.add(appSiteRuleDTO);
|
|
|
+ }
|
|
|
+ appSiteRuleTimeFormDTO.setAppSiteRuleDTOList(appSiteRuleDTOS);
|
|
|
+ }
|
|
|
+ appSiteRuleTimeFormDTO.setAppSiteRuleDTOList(appSiteRuleDTOS);
|
|
|
+ formDTOList.add(appSiteRuleTimeFormDTO);
|
|
|
+ }
|
|
|
+ System.out.println("数量为+++++++++++++++++++++++++++++++"+formDTOList.size());
|
|
|
+ appSiteCategoryRuleDTO.setAppSiteRuleTimeFormDTOList(formDTOList);
|
|
|
+ }
|
|
|
+ appSiteCategoryRuleDTOS.add(appSiteCategoryRuleDTO);
|
|
|
+ }
|
|
|
+ appSitePlaceParkDTO.setAppSiteCategoryRuleDTOS(appSiteCategoryRuleDTOS);
|
|
|
+ }
|
|
|
+ return appSitePlaceParkDTO;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<AppSite> queryByDeptId(String deptId) {
|
|
|
+ return appSiteMapper.selectList(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getTenantId, deptId));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 权限校验
|
|
|
*
|