| 
					
				 | 
			
			
				@@ -9,10 +9,12 @@ import org.apache.shiro.SecurityUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.common.exception.JeecgBootException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.common.system.vo.LoginUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.dto.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.jeecg.modules.system.app.entity.AppCategory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.entity.AppSite; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.entity.AppSitePlace; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.entity.AppSitePriceRules; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.enums.SitePlaceTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.jeecg.modules.system.app.mapper.AppCategoryMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.mapper.AppSiteMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.mapper.AppSitePlaceMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.app.mapper.AppSitePriceRulesMapper; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -41,37 +43,54 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private AppSitePriceRulesMapper appSitePriceRulesMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private AppSiteMapper appSiteMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private AppCategoryMapper appCategoryMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //学校 包场 一对多 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Boolean saveWitchPriceRules(AppSitePlaceDTO placeDTO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        AppSitePlaceCuDTO appSitePlaceCuDTO = placeDTO.getAppSitePlaceCuDTO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        AppSite appSite = appSiteMapper.selectById(appSitePlaceCuDTO.getSiteId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null == appSitePlaceCuDTO.getSiteId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            throw new JeecgBootException("商户补充信息id不能为空", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        AppSitePlace appSitePlace = new AppSitePlace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        BeanUtils.copyProperties(appSitePlaceCuDTO, appSitePlace); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        appSitePlace.setOrgCode(appSite.getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        appSitePlace.setTenantId(sysUser.getOrgId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        appSitePlace.setSiteId(appSitePlaceCuDTO.getSiteId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //循环添加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return Boolean.TRUE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -79,70 +98,98 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return Boolean.TRUE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -161,26 +208,26 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return appSiteRuleDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return new AppSitePlaceDTO(appSitePlaceCuDTO, collect); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return new AppSitePlaceDTO(appSitePlaceCuDTO, collect,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Boolean deleteWitchPriceRulesById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace dbPlace = baseMapper.selectById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null==dbPlace) throw new JeecgBootException("未找到对应数据", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null == dbPlace) throw new JeecgBootException("未找到对应数据", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        checkPermission(dbPlace,sysUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int deleteById = baseMapper.deleteById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (deleteById < 1) throw new JeecgBootException("删除失败", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int deletePriceResult = appSitePriceRulesMapper.delete(Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (deletePriceResult<1) throw new JeecgBootException("场地价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (deletePriceResult < 1) throw new JeecgBootException("场地价格规则删除失败", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return Boolean.TRUE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public IPage<AppSitePlaceCuDTO> queryWitchPriceRulesPage(AppSitePlacePageDTO dto) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null==dto.getType()) throw new JeecgBootException("请选择类型", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LambdaQueryWrapper<AppSitePlace> wrapper = Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getType, dto.getType()) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -189,16 +236,16 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         IPage<AppSitePlace> resultPage = baseMapper.selectPage(page, wrapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return resultPage.convert(record -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             AppSitePlaceCuDTO cuDTO = new AppSitePlaceCuDTO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BeanUtils.copyProperties(record,cuDTO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BeanUtils.copyProperties(record, cuDTO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return cuDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 无固定场 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 无固定场 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Boolean addUnfixed(AppSitePlaceUnfixedDTO unsetDTO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null==unsetDTO.getSiteId()) throw new JeecgBootException("请选择商户门店", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null == unsetDTO.getSiteId()) throw new JeecgBootException("请选择商户门店", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace appSitePlace = new AppSitePlace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BeanUtils.copyProperties(unsetDTO, appSitePlace); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -219,11 +266,12 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Boolean updateUnfixed(AppSitePlaceUnfixedDTO unsetDTO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null==unsetDTO.getSiteId()) throw new JeecgBootException("商户门店不能为空", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null == unsetDTO.getSiteId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new JeecgBootException("商户门店不能为空", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace dbSitePlace = baseMapper.selectById(unsetDTO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null==dbSitePlace) throw new JeecgBootException("数据不存在", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null == dbSitePlace) throw new JeecgBootException("数据不存在", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        checkPermission(dbSitePlace,sysUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace appSitePlace = new AppSitePlace(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -247,7 +295,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public Boolean deleteUnfixed(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace dbPlace = baseMapper.selectById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null == dbPlace)throw new JeecgBootException("未找到对应数据", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null == dbPlace) throw new JeecgBootException("未找到对应数据", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        dbPlace.setUpdateBy(sysUser.getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int deleteById = baseMapper.deleteById(dbPlace); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -260,7 +308,9 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public IPage<AppSitePlaceUnfixedDTO> queryUnfixedPage(AppSitePlaceUnfixedPageDTO dto) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Page<AppSitePlace> page = new Page<>(dto.getPageNum(), dto.getPageSize()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        LambdaQueryWrapper<AppSitePlace> wrapper = Wrappers.<AppSitePlace>lambdaQuery().eq(AppSitePlace::getType, SitePlaceTypeEnum.UNFIXED.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         IPage<AppSitePlace> resultPage = baseMapper.selectPage(page, wrapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return resultPage.convert(record -> { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -277,7 +327,7 @@ public class AppSitePlaceServiceImpl extends ServiceImpl<AppSitePlaceMapper, App 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public AppSitePlaceUnfixedDTO queryUnfixedById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlace dbSitePlace = baseMapper.selectById(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null==dbSitePlace) throw new JeecgBootException("无固定场数据不存在", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null == dbSitePlace) throw new JeecgBootException("无固定场数据不存在", SC_INTERNAL_SERVER_ERROR_500); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectOne( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Wrappers.<AppSitePriceRules>lambdaQuery().eq(AppSitePriceRules::getSitePlaceId, dbSitePlace.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppSitePlaceUnfixedDTO appSitePlaceUnfixedDTO = new AppSitePlaceUnfixedDTO(); 
			 |