| | |
| | | package com.qianwen.smartman.modules.notify.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.mp.base.BaseServiceImpl; |
| | | import com.qianwen.core.notify.template.TemplateProvider; |
| | |
| | | import com.qianwen.core.tool.metadata.ConfigPropertyMetadata; |
| | | import com.qianwen.core.tool.metadata.types.StringType; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.modules.notify.entity.BusinessNotify; |
| | | import com.qianwen.smartman.modules.notify.entity.NotifyTemplateEntity; |
| | | import com.qianwen.smartman.modules.notify.enums.NotifyTemplateExpandEnum; |
| | | import com.qianwen.smartman.modules.notify.mapper.BusinessNotifyMapper; |
| | | import com.qianwen.smartman.modules.notify.mapper.NotifyTemplateMapper; |
| | | import com.qianwen.smartman.modules.notify.service.INotifyTemplateService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/service/impl/NotifyTemplateServiceImpl.class */ |
| | | public class NotifyTemplateServiceImpl extends BaseServiceImpl<NotifyTemplateMapper, NotifyTemplateEntity> implements INotifyTemplateService { |
| | | private static final Logger log = LoggerFactory.getLogger(NotifyTemplateServiceImpl.class); |
| | | @Autowired |
| | | private BusinessNotifyMapper businessNotifyMapper; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -330190124: |
| | | if (implMethodName.equals("getNotifyTemplateId")) { |
| | | z = false; |
| | | 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/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getNotifyTemplateId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.notify.service.INotifyTemplateService |
| | | public boolean checkUsedByBusinessNotify(String id) { |
| | | Long count = this.businessNotifyMapper.selectCount(Wrappers.<BusinessNotify>lambdaQuery() |
| | | .eq(BusinessNotify::getNotifyTemplateId, id)); |
| | | /* |
| | | Long count = this.businessNotifyMapper.selectCount((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getNotifyTemplateId(); |
| | | }, id)); |
| | | }, id));*/ |
| | | if (count.longValue() > 0) { |
| | | throw new ServiceException("当前通知模板正在被业务使用,无法删除"); |
| | | } |
| | |
| | | public ConfigMetadata getAllTypes(String type, String provider, List<TemplateProvider> providers) { |
| | | NotifyTemplateExpandEnum[] values; |
| | | ConfigMetadata result = null; |
| | | List<TemplateProvider> providerList = (List) providers.stream().filter(prov -> { |
| | | List<TemplateProvider> providerList = providers.stream().filter(prov -> { |
| | | return prov.getType().getId().equalsIgnoreCase(type) && prov.getProvider().getId().equalsIgnoreCase(provider); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(providerList)) { |