## 报单赠送定时任务优化
This commit is contained in:
		
							parent
							
								
									2475088bb9
								
							
						
					
					
						commit
						a9a764ab7e
					
				|  | @ -178,6 +178,17 @@ public class AcTourismServiceProvider implements IAcTourismServiceApi { | |||
|                 .filter(order -> !existSet.contains(order.getOrderCode())) | ||||
|                 .collect(Collectors.toList()); | ||||
| 
 | ||||
| 
 | ||||
|         // 批量查询这些活动对应的权限记录 | ||||
|         List<AcBaseAuthority> allAuthorityList = iAcBaseAuthorityService.list( | ||||
|                 Wrappers.<AcBaseAuthority>lambdaQuery() | ||||
|                         .in(AcBaseAuthority::getPkBaseId, declarationBaseIds) | ||||
|                         .eq(AcBaseAuthority::getDelFlag, EDelFlag.UN_DELETE.getValue()) | ||||
|         ); | ||||
| 
 | ||||
|         Map<Long, List<AcBaseAuthority>> authorityCache = allAuthorityList.stream() | ||||
|                 .collect(Collectors.groupingBy(AcBaseAuthority::getPkBaseId)); | ||||
| 
 | ||||
|         List<AcDeclarationGiftRecord> recordList = new ArrayList<>(); | ||||
|         orderList.forEach(order -> { | ||||
|             // 新会员信息 | ||||
|  | @ -199,8 +210,7 @@ public class AcTourismServiceProvider implements IAcTourismServiceApi { | |||
|                 return; | ||||
|             } | ||||
|             // 查询活动权限 | ||||
|             AcBaseConfig baseConfig = iAcBaseConfigService.getById(matchedConfig.getPkBaseId()); | ||||
|             if (!this.checkAuthority(baseConfig, order.getPkMember())) { | ||||
|             if (!this.checkAuthority(matchedConfig.getPkBaseId(), order.getPkMember(),newMember.getMemberCode(),authorityCache)) { | ||||
|                 return; | ||||
|             } | ||||
|             AcDeclarationGiftRecord record = AcDeclarationGiftRecord.builder() | ||||
|  | @ -225,15 +235,15 @@ public class AcTourismServiceProvider implements IAcTourismServiceApi { | |||
|     /** | ||||
|      * 校验活动权限(true:进行处理,false:不进行处理) | ||||
|      * | ||||
|      * @param baseConfig 活动配置 | ||||
|      * @param pkMember   会员ID | ||||
|      * @param memberCode | ||||
|      * @param authorityCache | ||||
|      * @return | ||||
|      */ | ||||
|     private boolean checkAuthority(AcBaseConfig baseConfig, Long pkMember) { | ||||
|         List<AcBaseAuthority> authList = iAcBaseAuthorityService.list(Wrappers.<AcBaseAuthority>lambdaQuery() | ||||
|                 .eq(AcBaseAuthority::getPkBaseId, baseConfig.getPkId()) | ||||
|                 .orderByDesc(AcBaseAuthority::getAuthorityType) | ||||
|         ); | ||||
|     private boolean checkAuthority(Long pkBaseId, Long pkMember, String memberCode, Map<Long, List<AcBaseAuthority>> authorityCache) { | ||||
|         List<AcBaseAuthority> authList = authorityCache.get(pkBaseId); | ||||
|         if (CollectionUtil.isEmpty(authList)) { | ||||
|             return true; | ||||
|         } | ||||
|         if (CollectionUtil.isNotEmpty(authList)) { | ||||
|             Map<Integer, List<String>> authMap = new HashMap<>(); | ||||
|             for (AcBaseAuthority authority : authList) { | ||||
|  | @ -275,7 +285,15 @@ public class AcTourismServiceProvider implements IAcTourismServiceApi { | |||
|                         } else { | ||||
|                             return false; | ||||
|                         } | ||||
|                     case MEMBER: | ||||
|                         // 指定会员 | ||||
|                         if (authMap.get(key).contains(memberCode)) { | ||||
|                             return true; | ||||
|                         } else { | ||||
|                             return false; | ||||
|                         } | ||||
|                     default: | ||||
|                         return true; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue