| | |
| | | package com.qianwen.smartman.modules.notify.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.context.task.TaskExecutionContext; |
| | | import com.qianwen.core.context.task.TaskExecutorTypeEnum; |
| | | import com.qianwen.core.notify.DefaultNotifyType; |
| | |
| | | import com.qianwen.smartman.modules.notify.convert.BusinessNotifyConvert; |
| | | import com.qianwen.smartman.modules.notify.dto.BusinessNotifyDTO; |
| | | import com.qianwen.smartman.modules.notify.dto.NotifyUserDTO; |
| | | import com.qianwen.smartman.modules.notify.entity.BusinessNotify; |
| | | import com.qianwen.smartman.modules.notify.mapper.BusinessNotifyMapper; |
| | | import com.qianwen.smartman.modules.notify.service.IBusinessNotifyService; |
| | | import com.qianwen.smartman.modules.system.service.IUserOauthService; |
| | | import com.qianwen.smartman.modules.system.service.IUserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/service/impl/NotifyTaskServiceImpl.class */ |
| | |
| | | private final IUserOauthService userOauthService; |
| | | private final IEmployeeService employeeService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case 584947017: |
| | | if (implMethodName.equals("getBusinessKey")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case 771206363: |
| | | if (implMethodName.equals("getTenantId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | switch (z) { |
| | | case false: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/notify/entity/BusinessNotify") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getBusinessKey(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/tenant/mp/TenantEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getTenantId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public NotifyTaskServiceImpl(final IBusinessNotifyService businessNotifyService, final BusinessNotifyMapper businessNotifyMapper, final IUserService userService, final IUserOauthService userOauthService, final IEmployeeService employeeService) { |
| | | this.businessNotifyService = businessNotifyService; |
| | |
| | | |
| | | private List<NotifyUserDTO> getNotifySubscriberList(List<String> notifySubscriberList, TaskExecutorTypeEnum taskExecutorTypeEnum) { |
| | | List<NotifyUserDTO> result; |
| | | //没问题了,根据使用的service判断 |
| | | switch (taskExecutorTypeEnum) { |
| | | case EMPLOYEE://gui: email |
| | | result = this.employeeService.getNotifySubscriberList(notifySubscriberList); |
| | | break; |
| | | default: |
| | | result = this.userService.getNotifySubscriberList(notifySubscriberList); |
| | | } |
| | | |
| | | /* |
| | | switch (AnonymousClass1.$SwitchMap$org$springblade$core$context$task$TaskExecutorTypeEnum[taskExecutorTypeEnum.ordinal()]) { |
| | | case 1: |
| | | result = this.employeeService.getNotifySubscriberList(notifySubscriberList); |
| | |
| | | default: |
| | | result = this.userService.getNotifySubscriberList(notifySubscriberList); |
| | | break; |
| | | } |
| | | }*/ |
| | | return result; |
| | | } |
| | | |
| | |
| | | List<String> result = new ArrayList<>(); |
| | | if (Func.isNotEmpty(notifySubscriberList)) { |
| | | List<NotifyUserDTO> notifyUserDTOS = getNotifySubscriberList(notifySubscriberList, taskExecutorTypeEnum); |
| | | switch (DefaultNotifyType.of(defaultNotifyType)) { |
| | | case email: |
| | | result.addAll(notifyUserDTOS.stream().map(NotifyUserDTO::getEmail).filter(Func::isNotEmpty).collect(Collectors.toList())); |
| | | break; |
| | | case sms: |
| | | result.addAll(notifyUserDTOS.stream().map(NotifyUserDTO::getPhone).filter(Func::isNotEmpty).collect(Collectors.toList())); |
| | | break; |
| | | case weiXinMini: |
| | | result.addAll(notifyUserDTOS.stream().map(NotifyUserDTO::getWeiXinMiniUserId).filter(Func::isNotEmpty).collect(Collectors.toList())); |
| | | case internalMessage: |
| | | default: |
| | | result.addAll(notifyUserDTOS.stream().map(NotifyUserDTO::getUserId).map(Func::toStr).collect(Collectors.toList())); |
| | | break; |
| | | } |
| | | /* |
| | | switch (AnonymousClass1.$SwitchMap$org$springblade$core$notify$DefaultNotifyType[DefaultNotifyType.of(defaultNotifyType).ordinal()]) { |
| | | case 1: |
| | | result.addAll((Collection) notifyUserDTOS.stream().map((v0) -> { |
| | |
| | | return Func.toStr(v0); |
| | | }).collect(Collectors.toList())); |
| | | break; |
| | | } |
| | | }*/ |
| | | } |
| | | result.removeAll(Collections.singleton(null)); |
| | | return result; |
| | | } |
| | | |
| | | /* JADX INFO: Access modifiers changed from: package-private */ |
| | | /* renamed from: org.springblade.modules.notify.service.impl.NotifyTaskServiceImpl$1 reason: invalid class name */ |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/service/impl/NotifyTaskServiceImpl$1.class */ |
| | | public static /* synthetic */ class AnonymousClass1 { |
| | | static final /* synthetic */ int[] $SwitchMap$org$springblade$core$context$task$TaskExecutorTypeEnum; |
| | | static final /* synthetic */ int[] $SwitchMap$org$springblade$core$notify$DefaultNotifyType = new int[DefaultNotifyType.values().length]; |
| | | |
| | | static { |
| | | try { |
| | | $SwitchMap$org$springblade$core$notify$DefaultNotifyType[DefaultNotifyType.email.ordinal()] = 1; |
| | | } catch (NoSuchFieldError e) { |
| | | } |
| | | try { |
| | | $SwitchMap$org$springblade$core$notify$DefaultNotifyType[DefaultNotifyType.sms.ordinal()] = 2; |
| | | } catch (NoSuchFieldError e2) { |
| | | } |
| | | try { |
| | | $SwitchMap$org$springblade$core$notify$DefaultNotifyType[DefaultNotifyType.weiXinMini.ordinal()] = 3; |
| | | } catch (NoSuchFieldError e3) { |
| | | } |
| | | try { |
| | | $SwitchMap$org$springblade$core$notify$DefaultNotifyType[DefaultNotifyType.internalMessage.ordinal()] = 4; |
| | | } catch (NoSuchFieldError e4) { |
| | | } |
| | | $SwitchMap$org$springblade$core$context$task$TaskExecutorTypeEnum = new int[TaskExecutorTypeEnum.values().length]; |
| | | try { |
| | | $SwitchMap$org$springblade$core$context$task$TaskExecutorTypeEnum[TaskExecutorTypeEnum.EMPLOYEE.ordinal()] = 1; |
| | | } catch (NoSuchFieldError e5) { |
| | | } |
| | | try { |
| | | $SwitchMap$org$springblade$core$context$task$TaskExecutorTypeEnum[TaskExecutorTypeEnum.USER.ordinal()] = 2; |
| | | } catch (NoSuchFieldError e6) { |
| | | } |
| | | } |
| | | } |
| | | |
| | | public List<NotifyExecutionContext> createNotifyExecutionContext(TaskExecutionContext taskExecutionContext) { |
| | | List<NotifyExecutionContext> result = new CopyOnWriteArrayList<>(); |
| | | List<BusinessNotifyDTO> finallyBusiness = BusinessNotifyConvert.INSTANCE.convertToDTOList(this.businessNotifyService |
| | | .list(Wrappers.<BusinessNotify>query().lambda() |
| | | .eq(BusinessNotify::getBusinessKey, taskExecutionContext.getBusiness()) |
| | | .eq(BusinessNotify::getTenantId, taskExecutionContext.getTenantId()))); |
| | | /* |
| | | List<BusinessNotifyDTO> finallyBusiness = BusinessNotifyConvert.INSTANCE.convertToDTOList(this.businessNotifyService.list((Wrapper) ((LambdaQueryWrapper) Wrappers.query().lambda().eq((v0) -> { |
| | | return v0.getBusinessKey(); |
| | | }, taskExecutionContext.getBusiness())).eq((v0) -> { |
| | | return v0.getTenantId(); |
| | | }, taskExecutionContext.getTenantId()))); |
| | | }, taskExecutionContext.getTenantId())));*/ |
| | | if (Func.isNotEmpty(finallyBusiness)) { |
| | | finallyBusiness.forEach(notify -> { |
| | | List<String> notifiedPartys = getNotifiedPartyList(taskExecutionContext.getTenantId(), taskExecutionContext.getBusiness(), notify.getNotifyType(), taskExecutionContext.getRelatedPersonals(), taskExecutionContext.getTaskExecutorTypeEnum()); |
| | | Object sendInfo = taskExecutionContext.getExtendInfo().get("notify_direct_address"); |
| | | if (Func.isNotEmpty(sendInfo)) { |
| | | List<NotifyDirectSendInfo> sendInfoList = new ArrayList<>(); |
| | | List<Map<String, Object>> data = (List) sendInfo; |
| | | List<Map<String, Object>> data = (List<Map<String, Object>>)sendInfo; |
| | | //List<Map<String, Object>> data = sendInfo; |
| | | data.forEach(x -> { |
| | | NotifyDirectSendInfo notifyDirectSendInfo = (NotifyDirectSendInfo) BeanUtil.toBean(x, NotifyDirectSendInfo.class); |
| | | notifyDirectSendInfo.setNotifyType(DefaultNotifyType.of(x.get("notifyType").toString())); |
| | | sendInfoList.add(notifyDirectSendInfo); |
| | | }); |
| | | ((List) sendInfoList.stream().filter(x2 -> { |
| | | (sendInfoList.stream().filter(x2 -> { |
| | | return notify.getNotifyType().equals(x2.getNotifyType().getId()); |
| | | }).collect(Collectors.toList())).forEach(x3 -> { |
| | | notifiedPartys.addAll(x3.getDirectSendAddress()); |