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