| 
					
				 | 
			
			
				@@ -19,6 +19,7 @@ import org.jeecg.modules.system.app.mapper.AppSiteMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.mapper.AppSitePlaceMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.mapper.AppSitePriceRulesMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.service.IAppSitePlaceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.jeecg.modules.system.app.utils.TimeRangeFinder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.BeanUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -46,156 +47,127 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private AppCategoryMapper appCategoryMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //学校 包场 一对多 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //学校 一对多 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public Boolean saveWitchPriceRules(AppSitePlaceDTO placeDTO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        AppSitePlaceCuDTO appSitePlaceCuDTO = placeDTO.getAppSitePlaceCuDTO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        AppSiteCategoryDOT appSiteCategoryDOT = placeDTO.getAppSiteCategoryDOT(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (null == appSitePlaceCuDTO.getSiteId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            throw new JeecgBootException("商户补充信息id不能为空", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        AppSite site = appSiteMapper.selectById(appSitePlaceCuDTO.getSiteId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (site == null) throw new JeecgBootException("商户不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (appSitePlaceCuDTO.getInventory() < 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            throw new JeecgBootException("场所数、票数不能为0或负数", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        for (String s : appSitePlaceCuDTO.getCategoryId().split(",")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            AppCategory category = appCategoryMapper.selectById(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            for (int i = 0; i < appSitePlaceCuDTO.getInventory(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                AppSitePlace appSitePlace = new AppSitePlace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                BeanUtils.copyProperties(appSitePlaceCuDTO, appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                appSitePlace.setName(category.getName() + i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                appSitePlace.setOrgCode(site.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                appSitePlace.setTenantId(site.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                appSitePlace.setSiteId(site.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                int insert = baseMapper.insert(appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                if (insert < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    throw new JeecgBootException("商户场所保存失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                placeDTO.getSiteRuleDTOS().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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //循环添加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Boolean saveSchool(AppSitePlaceSchoolDTO placeDTO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AppSitePlaceCuDTO appSitePlaceCuDTO = placeDTO.getAppSitePlaceCuDTO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null == appSitePlaceCuDTO.getSiteId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new JeecgBootException("商户补充信息id不能为空", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AppSite site = appSiteMapper.selectById(appSitePlaceCuDTO.getSiteId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AppSitePlace appSitePlace = new AppSitePlace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BeanUtils.copyProperties(appSitePlaceCuDTO, appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        appSitePlace.setOrgCode(site.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        appSitePlace.setTenantId(site.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        appSitePlace.setSiteId(site.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //时间段提取拼接 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String  teachingDay= ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String  noTeachingDay= ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!siteRuleDTOS.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        site.setTeachingDay(teachingDay); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        site.setNoTeachingDay(noTeachingDay); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int updateById = appSiteMapper.updateById(site); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (updateById < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new JeecgBootException("学校补充信息更新失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int insert = baseMapper.insert(appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (insert < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new JeecgBootException("学校场所信息保存失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        siteRuleDTOS.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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return Boolean.TRUE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public Boolean editWitchPriceRules(AppSitePlaceDTO placeDTO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        AppSitePlaceCuDTO appSitePlaceCuDTO = placeDTO.getAppSitePlaceCuDTO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (null == appSitePlaceCuDTO.getSiteId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            throw new JeecgBootException("商户补充信息id不能为空", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        AppSite site = appSiteMapper.selectById(appSitePlaceCuDTO.getSiteId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (site == null) throw new JeecgBootException("商户不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<AppSitePlace> dbPlaceList = baseMapper.selectList(Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getSiteId, appSitePlaceCuDTO.getSiteId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (dbPlaceList.isEmpty()) throw new JeecgBootException("数据不存在", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        //部门校验 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-////        checkPermission(dbPlace, sysUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        Integer inventoryNew = appSitePlaceCuDTO.getInventory(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (inventoryNew < 1) throw new JeecgBootException("场所数、票数不能为0或负数", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        int size = dbPlaceList.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        //场所数量判断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (size == inventoryNew) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            dbPlaceList.forEach(dbPlace -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                AppSitePlace appSitePlace = new AppSitePlace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                BeanUtils.copyProperties(appSitePlaceCuDTO, appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                //不许更改项赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                appSitePlace.setOrgCode(site.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                appSitePlace.setTenantId(site.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                int update = baseMapper.updateById(appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                if (update < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    throw new JeecgBootException("商户场所保存失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                        .eq(AppSitePriceRules::getSitePlaceId, dbPlace.getId())).forEach(appSitePriceRules -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        AppSitePlace appSitePlace = new AppSitePlace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        BeanUtils.copyProperties(appSitePlaceCuDTO, appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        //不许更改项赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        appSitePlace.setOrgCode(site.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        appSitePlace.setTenantId(site.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        int update = baseMapper.updateById(appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if (update < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            throw new JeecgBootException("商户场所保存失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<AppSitePriceRules> dbRulesList = appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        //删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<AppSitePriceRules> deleteList = dbRulesList.stream().filter( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                dbRule -> dbRule.getId() != null && siteRuleDTOS.stream().noneMatch(rule -> dbRule.getId().equals(rule.getId()))).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        deleteList.forEach( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                dbRule -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    int deleteResult = appSitePriceRulesMapper.deleteById(dbRule.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    if (deleteResult < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                        throw new JeecgBootException("场所价格规则删除失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        //保存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<AppSitePriceRules> addList = siteRuleDTOS.stream().filter(rule -> rule.getId() == null).map(ruleDTO -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            AppSitePriceRules appSitePriceRules = new AppSitePriceRules(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            BeanUtils.copyProperties(ruleDTO, appSitePriceRules); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            appSitePriceRules.setOrgCode(appSitePlace.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            appSitePriceRules.setTenantId(appSitePlace.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            appSitePriceRules.setSitePlaceId(appSitePlace.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            return appSitePriceRules; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        }).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        addList.forEach(appSitePriceRules -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            int saveResult = appSitePriceRulesMapper.insert(appSitePriceRules); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            if (saveResult < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                throw new JeecgBootException("场所价格规则保存失败", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        //更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        List<AppSitePriceRules> updateList = siteRuleDTOS.stream().filter( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                rule -> rule.getId() != null && dbRulesList.stream().anyMatch( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                        dbRule -> dbRule.getId().equals(rule.getId()))).map(ruleDto -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            AppSitePriceRules appSitePriceRules = new AppSitePriceRules(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            BeanUtils.copyProperties(ruleDto, appSitePriceRules); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            appSitePriceRules.setSitePlaceId(appSitePlace.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            appSitePriceRules.setOrgCode(appSitePlace.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            appSitePriceRules.setTenantId(appSitePlace.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            return appSitePriceRules; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        }).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        updateList.forEach(rule -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            int updateById = appSitePriceRulesMapper.updateById(rule); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            if (updateById < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                throw new JeecgBootException("场所价格规则更新失败", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Boolean editSchool(AppSitePlaceSchoolDTO placeDTO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AppSitePlaceCuDTO appSitePlaceCuDTO = placeDTO.getAppSitePlaceCuDTO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null == appSitePlaceCuDTO.getSiteId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new JeecgBootException("商户补充信息id不能为空", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AppSitePlace dbPlace = baseMapper.selectById(appSitePlaceCuDTO.getSiteId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null == dbPlace) throw new JeecgBootException("数据不存在", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //部门校验 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        checkPermission(dbPlace, sysUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AppSitePlace appSitePlace = new AppSitePlace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BeanUtils.copyProperties(appSitePlaceCuDTO, appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //不许更改项赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        appSitePlace.setOrgCode(sysUser.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        appSitePlace.setTenantId(sysUser.getOrgId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        appSitePlace.setSiteId(appSitePlaceCuDTO.getSiteId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int update = baseMapper.updateById(appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (update < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new JeecgBootException("商户场所保存失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<AppSitePriceRules> dbRulesList = appSitePriceRulesMapper.selectList(Wrappers.<AppSitePriceRules>lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .eq(AppSitePriceRules::getSitePlaceId, appSitePlace.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<AppSiteRuleDTO> siteRuleDTOS = placeDTO.getSiteRuleDTOS(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<AppSitePriceRules> deleteList = dbRulesList.stream().filter( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dbRule -> dbRule.getId() != null && siteRuleDTOS.stream().noneMatch(rule -> dbRule.getId().equals(rule.getId()))).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        deleteList.forEach( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dbRule -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    int deleteResult = appSitePriceRulesMapper.deleteById(dbRule.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (deleteResult < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new JeecgBootException("场所价格规则删除失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //保存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<AppSitePriceRules> addList = siteRuleDTOS.stream().filter(rule -> rule.getId() == null).map(ruleDTO -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AppSitePriceRules appSitePriceRules = new AppSitePriceRules(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BeanUtils.copyProperties(ruleDTO, appSitePriceRules); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            appSitePriceRules.setOrgCode(appSitePlace.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            appSitePriceRules.setTenantId(appSitePlace.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            appSitePriceRules.setSitePlaceId(appSitePlace.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return appSitePriceRules; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        addList.forEach(appSitePriceRules -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int saveResult = appSitePriceRulesMapper.insert(appSitePriceRules); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (saveResult < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new JeecgBootException("场所价格规则保存失败", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<AppSitePriceRules> updateList = siteRuleDTOS.stream().filter( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                rule -> rule.getId() != null && dbRulesList.stream().anyMatch( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        dbRule -> dbRule.getId().equals(rule.getId()))).map(ruleDto -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AppSitePriceRules appSitePriceRules = new AppSitePriceRules(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BeanUtils.copyProperties(ruleDto, appSitePriceRules); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            appSitePriceRules.setSitePlaceId(appSitePlace.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            appSitePriceRules.setOrgCode(appSitePlace.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            appSitePriceRules.setTenantId(appSitePlace.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return appSitePriceRules; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        updateList.forEach(rule -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int updateById = appSitePriceRulesMapper.updateById(rule); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (updateById < 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new JeecgBootException("场所价格规则更新失败", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return Boolean.TRUE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public AppSitePlaceDTO queryWitchPriceRulesById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AppSitePlaceSchoolDTO querySchoolById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace appSitePlace = baseMapper.selectById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (null == appSitePlace) throw new JeecgBootException("数据不存在", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlaceCuDTO appSitePlaceCuDTO = new AppSitePlaceCuDTO(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -208,12 +180,12 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return appSiteRuleDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return new AppSitePlaceDTO(appSitePlaceCuDTO, collect,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return new AppSitePlaceSchoolDTO(appSitePlaceCuDTO, collect); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public Boolean deleteWitchPriceRulesById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Boolean deleteSchoolById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace dbPlace = baseMapper.selectById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (null == dbPlace) throw new JeecgBootException("未找到对应数据", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -226,7 +198,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public IPage<AppSitePlaceCuDTO> queryWitchPriceRulesPage(AppSitePlacePageDTO dto) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public IPage<AppSitePlaceCuDTO> querySchoolPage(AppSitePlacePageDTO dto) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (null == dto.getType()) throw new JeecgBootException("请选择类型", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Page<AppSitePlace> page = new Page<>(dto.getPageNum(), dto.getPageSize()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -247,11 +219,12 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Boolean addUnfixed(AppSitePlaceUnfixedDTO unsetDTO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (null == unsetDTO.getSiteId()) throw new JeecgBootException("请选择商户门店", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AppSite site = appSiteMapper.selectById(unsetDTO.getSiteId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace appSitePlace = new AppSitePlace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BeanUtils.copyProperties(unsetDTO, appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         appSitePlace.setType(SitePlaceTypeEnum.UNFIXED.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        appSitePlace.setOrgCode(sysUser.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        appSitePlace.setTenantId(sysUser.getOrgId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        appSitePlace.setOrgCode(site.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        appSitePlace.setTenantId(site.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int insert = baseMapper.insert(appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (insert < 1) throw new JeecgBootException("无固定场添加失败", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePriceRules appSitePriceRules = new AppSitePriceRules(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -273,13 +246,13 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace dbSitePlace = baseMapper.selectById(unsetDTO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (null == dbSitePlace) throw new JeecgBootException("数据不存在", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        checkPermission(dbSitePlace,sysUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AppSite site = appSiteMapper.selectById(unsetDTO.getSiteId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace appSitePlace = new AppSitePlace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BeanUtils.copyProperties(unsetDTO, appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //固定 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         appSitePlace.setType(SitePlaceTypeEnum.UNFIXED.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        appSitePlace.setOrgCode(sysUser.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        appSitePlace.setTenantId(sysUser.getOrgId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        appSitePlace.setOrgCode(site.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        appSitePlace.setTenantId(site.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int updateById = baseMapper.updateById(appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (updateById < 1) throw new JeecgBootException("无固定场编辑失败", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePriceRules appSitePriceRules = new AppSitePriceRules(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -307,10 +280,12 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public IPage<AppSitePlaceUnfixedDTO> queryUnfixedPage(AppSitePlaceUnfixedPageDTO dto) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Page<AppSitePlace> page = new Page<>(dto.getPageNum(), dto.getPageSize()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LambdaQueryWrapper<AppSitePlace> wrapper = Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getType, SitePlaceTypeEnum.UNFIXED.getCode()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .eq(AppSitePlace::getSiteId, dto.getSiteId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .like(StringUtils.isNotBlank(dto.getName()), AppSitePlace::getName, dto.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                .eq(AppSitePlace::getOrgCode, loginUser.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         IPage<AppSitePlace> resultPage = baseMapper.selectPage(page, wrapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return resultPage.convert(record -> { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -326,6 +301,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public AppSitePlaceUnfixedDTO queryUnfixedById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace dbSitePlace = baseMapper.selectById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (null == dbSitePlace) throw new JeecgBootException("无固定场数据不存在", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectOne( 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -338,6 +314,26 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return appSitePlaceUnfixedDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Boolean savePack(AppSitePlaceDTO placeDTO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Boolean editPack(AppSitePlaceDTO placeDTO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public AppSitePlaceDTO queryPackById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Boolean deletePackById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 权限校验 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 
			 |