package com.qianwen.smartman.modules.notify.service.impl;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
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.time.LocalDateTime;
|
import java.util.ArrayList;
|
import java.util.Collections;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.Objects;
|
import java.util.stream.Collectors;
|
import java.util.stream.Stream;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import com.qianwen.smartman.common.cache.RegionCache;
|
import com.qianwen.smartman.common.constant.NotifyConstant;
|
import com.qianwen.smartman.common.utils.MessageUtils;
|
import com.qianwen.core.cache.utils.CacheUtil;
|
import com.qianwen.core.log.exception.ServiceException;
|
import com.qianwen.core.mp.base.BaseEntity;
|
import com.qianwen.core.mp.base.BaseServiceImpl;
|
import com.qianwen.core.tool.node.ForestNodeMerger;
|
import com.qianwen.core.tool.utils.Func;
|
import com.qianwen.smartman.modules.cps.entity.Employee;
|
import com.qianwen.smartman.modules.cps.service.IEmployeeService;
|
import com.qianwen.smartman.modules.notify.convert.BusinessNotifyConvert;
|
import com.qianwen.smartman.modules.notify.dto.BusinessNotifyDTO;
|
import com.qianwen.smartman.modules.notify.dto.NotifyBusinessTreeDTO;
|
import com.qianwen.smartman.modules.notify.dto.NotifySendDTO;
|
import com.qianwen.smartman.modules.notify.dto.NotifySendMethodDTO;
|
import com.qianwen.smartman.modules.notify.dto.NotifyTypeInfo;
|
import com.qianwen.smartman.modules.notify.dto.ProviderInfo;
|
import com.qianwen.smartman.modules.notify.entity.BusinessNotify;
|
import com.qianwen.smartman.modules.notify.entity.NotifyConfigEntity;
|
import com.qianwen.smartman.modules.notify.entity.NotifyTemplateEntity;
|
import com.qianwen.smartman.modules.notify.manager.NotifyBusinessManager;
|
import com.qianwen.smartman.modules.notify.mapper.BusinessNotifyMapper;
|
import com.qianwen.smartman.modules.notify.service.IBusinessNotifyService;
|
import com.qianwen.smartman.modules.notify.service.INotifyDefaultPersonService;
|
import com.qianwen.smartman.modules.notify.service.INotifyTemplateService;
|
import com.qianwen.smartman.modules.notify.vo.NotifyBusinessChangeStatusVO;
|
import com.qianwen.smartman.modules.notify.vo.NotifyBusinessSaveVO;
|
import com.qianwen.smartman.modules.notify.vo.NotifyBusinessTreeVO;
|
import com.qianwen.smartman.modules.notify.vo.NotifyDefaultObjectVO;
|
import com.qianwen.smartman.modules.system.service.IDictService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.context.annotation.Lazy;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
@Transactional(rollbackFor = {Exception.class})
|
@Service
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/service/impl/BusinessNotifyServiceImpl.class */
|
public class BusinessNotifyServiceImpl extends BaseServiceImpl<BusinessNotifyMapper, BusinessNotify> implements IBusinessNotifyService {
|
private static final Logger log = LoggerFactory.getLogger(BusinessNotifyServiceImpl.class);
|
private final NotifyConfigServiceImpl notifyConfigService;
|
private final INotifyTemplateService notifyTemplateService;
|
private final BusinessNotifyMapper businessNotifyMapper;
|
private final IDictService dictService;
|
private final IEmployeeService employeeService;
|
@Autowired
|
private INotifyDefaultPersonService notifyDefaultPersonService;
|
@Autowired
|
@Lazy
|
private NotifyBusinessManager notifyBusinessManager;
|
|
private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) {
|
String implMethodName = lambda.getImplMethodName();
|
boolean z = true;
|
switch (implMethodName.hashCode()) {
|
case -1462663655:
|
if (implMethodName.equals("getNotifyType")) {
|
z = true;
|
break;
|
}
|
break;
|
case -330190124:
|
if (implMethodName.equals("getNotifyTemplateId")) {
|
z = true;
|
break;
|
}
|
break;
|
case -75106384:
|
if (implMethodName.equals("getType")) {
|
z = true;
|
break;
|
}
|
break;
|
case 98245393:
|
if (implMethodName.equals("getId")) {
|
z = true;
|
break;
|
}
|
break;
|
case 584947017:
|
if (implMethodName.equals("getBusinessKey")) {
|
z = false;
|
break;
|
}
|
break;
|
case 803533544:
|
if (implMethodName.equals("getStatus")) {
|
z = true;
|
break;
|
}
|
break;
|
case 931069238:
|
if (implMethodName.equals("getBusiness")) {
|
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();
|
};
|
}
|
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();
|
};
|
}
|
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/modules/notify/entity/NotifyConfigEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
|
return (v0) -> {
|
return v0.getType();
|
};
|
}
|
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/NotifyTemplateEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
|
return (v0) -> {
|
return v0.getType();
|
};
|
}
|
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/NotifyConfigEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
|
return (v0) -> {
|
return v0.getType();
|
};
|
}
|
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/modules/notify/entity/BusinessNotify") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
|
return (v0) -> {
|
return v0.getNotifyTemplateId();
|
};
|
}
|
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/modules/notify/entity/BusinessNotify") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
|
return (v0) -> {
|
return v0.getNotifyType();
|
};
|
}
|
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.getNotifyType();
|
};
|
}
|
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/modules/notify/entity/NotifyTemplateEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
|
return (v0) -> {
|
return v0.getBusiness();
|
};
|
}
|
break;
|
case RegionCache.VILLAGE_LEVEL /* 5 */:
|
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/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
|
return (v0) -> {
|
return v0.getId();
|
};
|
}
|
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/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) {
|
return (v0) -> {
|
return v0.getId();
|
};
|
}
|
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/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) {
|
return (v0) -> {
|
return v0.getStatus();
|
};
|
}
|
break;
|
}
|
throw new IllegalArgumentException("Invalid lambda deserialization");
|
}
|
|
public BusinessNotifyServiceImpl(final NotifyConfigServiceImpl notifyConfigService, final INotifyTemplateService notifyTemplateService, final BusinessNotifyMapper businessNotifyMapper, final IDictService dictService, final IEmployeeService employeeService, final INotifyDefaultPersonService notifyDefaultPersonService, final NotifyBusinessManager notifyBusinessManager) {
|
this.notifyConfigService = notifyConfigService;
|
this.notifyTemplateService = notifyTemplateService;
|
this.businessNotifyMapper = businessNotifyMapper;
|
this.dictService = dictService;
|
this.employeeService = employeeService;
|
this.notifyDefaultPersonService = notifyDefaultPersonService;
|
this.notifyBusinessManager = notifyBusinessManager;
|
}
|
|
@Override // org.springblade.modules.notify.service.IBusinessNotifyService
|
public List<NotifyBusinessTreeVO> tree() {
|
List<NotifyBusinessTreeDTO> notifyList = this.businessNotifyMapper.treeList(NotifyConstant.NOTIFY_BUSINESS_KEY);
|
List<NotifyBusinessTreeVO> vos = BusinessNotifyConvert.INSTANCE.convertDTOToVO(notifyList);
|
List<NotifyBusinessTreeVO> trees = ForestNodeMerger.merge(vos);
|
count(trees);
|
return trees;
|
}
|
|
@Override // org.springblade.modules.notify.service.IBusinessNotifyService
|
public List<BusinessNotifyDTO> list(String businessKey) {
|
Map<String, NotifyTypeInfo> typeInfoMap = this.notifyConfigService.getNotifyInfo();
|
Map<String, BusinessNotifyDTO> businessMap = (Map) this.businessNotifyMapper.businessList(businessKey).stream().collect(Collectors.toMap((v0) -> {
|
return v0.getNotifyType();
|
}, notifyBusiness -> {
|
return notifyBusiness;
|
}));
|
Map<String, NotifyConfigEntity> configMap = this.notifyConfigService.getConfigs(CollectionUtil.list(Boolean.FALSE.booleanValue(), typeInfoMap.keySet()));
|
configMap.forEach(typeId, config -> {
|
BusinessNotifyDTO businessNotify = (BusinessNotifyDTO) businessMap.get(typeId);
|
boolean isExit = ObjectUtil.isNull(businessNotify);
|
BusinessNotifyDTO businessNotify2 = isExit ? new BusinessNotifyDTO() : businessNotify;
|
NotifyTypeInfo typeInfo = (NotifyTypeInfo) typeInfoMap.get(typeId);
|
ProviderInfo providerInfo = typeInfo.getProviderInfos().parallelStream().filter(p -> {
|
return p.getId().equals(config.getProvider());
|
}).findFirst().orElse(new ProviderInfo("未知服务类型", "未知id", "未知服务商"));
|
businessNotify2.setProviderName(providerInfo.getName());
|
businessNotify2.setNotifyName(typeInfo.getName());
|
businessNotify2.setNotifyType(typeId);
|
businessNotify2.setProviderType(providerInfo.getId());
|
businessNotify2.setBusinessName(isExit ? this.dictService.getValue(NotifyConstant.NOTIFY_BUSINESS_KEY, businessKey) : businessNotify2.getBusinessName());
|
businessNotify2.setBusinessKey(businessKey);
|
businessMap.put(typeId, businessNotify2);
|
});
|
List<BusinessNotifyDTO> result = new ArrayList<>();
|
Stream<String> stream = typeInfoMap.keySet().stream();
|
businessMap.getClass();
|
stream.map((v1) -> {
|
return r1.get(v1);
|
}).forEach(dto -> {
|
if (dto != null) {
|
result.add(dto);
|
}
|
});
|
return result;
|
}
|
|
@Override // org.springblade.modules.notify.service.IBusinessNotifyService
|
public NotifyBusinessSaveVO save(NotifyBusinessSaveVO notifyBusinessVO) {
|
NotifyTemplateEntity templateEntity = notifyBusinessVO.getTemplateEntity();
|
if (Func.isNotEmpty(templateEntity) && Func.isNotEmpty(templateEntity.getId())) {
|
CacheUtil.evict("blade:notify", "template:id:", templateEntity.getId(), false);
|
}
|
checkTemplateAndType(notifyBusinessVO);
|
NotifyConfigEntity entity = (NotifyConfigEntity) this.notifyConfigService.getOne((Wrapper) Wrappers.lambdaQuery().eq((v0) -> {
|
return v0.getType();
|
}, notifyBusinessVO.getBusinessNotify().getNotifyType()));
|
notifyBusinessVO.getBusinessNotify().setNotifyId(entity.getId());
|
this.notifyTemplateService.save(notifyBusinessVO.getTemplateEntity());
|
notifyBusinessVO.getBusinessNotify().setNotifyTemplateId(notifyBusinessVO.getTemplateEntity().getId());
|
save((BaseEntity) notifyBusinessVO.getBusinessNotify());
|
return notifyBusinessVO;
|
}
|
|
@Override // org.springblade.modules.notify.service.IBusinessNotifyService
|
public Boolean change(NotifyBusinessChangeStatusVO changeStatusVO) {
|
BusinessNotify businessNotify = (BusinessNotify) getOne((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery(BusinessNotify.class).eq((v0) -> {
|
return v0.getBusinessKey();
|
}, changeStatusVO.getBusinessKey())).eq((v0) -> {
|
return v0.getNotifyType();
|
}, changeStatusVO.getNotifyType()));
|
if (Objects.isNull(businessNotify)) {
|
throw new ServiceException(MessageUtils.message("notify.business.template.status.not.be.change", new Object[0]));
|
}
|
return Boolean.valueOf(changeStatus(Collections.singletonList(businessNotify.getId()), changeStatusVO.getStatus()));
|
}
|
|
@Override // org.springblade.modules.notify.service.IBusinessNotifyService
|
public NotifyTemplateEntity modify(NotifyTemplateEntity notifyTemplateEntity) {
|
if (Func.isNotEmpty(notifyTemplateEntity) && Func.isNotEmpty(notifyTemplateEntity.getId())) {
|
CacheUtil.evict("blade:notify", "template:id:", notifyTemplateEntity.getId(), false);
|
}
|
checkTemplate(notifyTemplateEntity);
|
this.notifyTemplateService.updateById(notifyTemplateEntity);
|
return notifyTemplateEntity;
|
}
|
|
@Override // org.springblade.modules.notify.service.IBusinessNotifyService
|
public boolean remove(Long templateId) {
|
this.notifyTemplateService.removeById(templateId);
|
return remove((Wrapper) Wrappers.lambdaQuery(BusinessNotify.class).eq((v0) -> {
|
return v0.getNotifyTemplateId();
|
}, templateId));
|
}
|
|
public List<Long> getNoticeEmpIds(List<Long> orgIds, List<Long> empIds) {
|
List<Employee> employees = this.employeeService.listByOrgIds(orgIds);
|
List<Long> itemEmpIds = (List) employees.stream().map((v0) -> {
|
return v0.getId();
|
}).collect(Collectors.toList());
|
empIds.addAll(itemEmpIds);
|
return (List) empIds.stream().distinct().collect(Collectors.toList());
|
}
|
|
@Override // org.springblade.modules.notify.service.IBusinessNotifyService
|
public void sendMessage(NotifySendDTO notifySendDTO) {
|
String businessKey = notifySendDTO.getBusinessKey();
|
List<BusinessNotify> list = list((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> {
|
return v0.getStatus();
|
}, 1)).eq((v0) -> {
|
return v0.getBusinessKey();
|
}, businessKey));
|
List<Long> templateIds = (List) list.stream().map((v0) -> {
|
return v0.getNotifyTemplateId();
|
}).collect(Collectors.toList());
|
List<NotifyTemplateEntity> notifyTemplateEntities = this.notifyTemplateService.listByIds(templateIds);
|
Map<Long, NotifyTemplateEntity> tempMap = (Map) notifyTemplateEntities.stream().collect(Collectors.toMap((v0) -> {
|
return v0.getId();
|
}, item -> {
|
return item;
|
}));
|
List<NotifySendMethodDTO> dtoList = new ArrayList<>();
|
for (BusinessNotify businessNotify : list) {
|
Long notifyTemplateId = businessNotify.getNotifyTemplateId();
|
NotifySendMethodDTO notifySendMethodDTO = new NotifySendMethodDTO();
|
NotifyTemplateEntity notifyTemplateEntity = tempMap.get(notifyTemplateId);
|
notifySendMethodDTO.setTemplateId(String.valueOf(notifyTemplateEntity.getId()));
|
notifySendMethodDTO.setNotifyId(String.valueOf(businessNotify.getNotifyId()));
|
notifySendMethodDTO.setNotifyType(businessNotify.getNotifyType());
|
dtoList.add(notifySendMethodDTO);
|
}
|
Map<String, Object> data = notifySendDTO.getData();
|
List<Long> empIds = notifySendDTO.getEmpIds();
|
List<Long> orgIds = notifySendDTO.getOrgIds();
|
NotifyDefaultObjectVO objectVO = this.notifyDefaultPersonService.getByBusinessKey(businessKey);
|
List<Long> defaultEmpId = objectVO.getEmpIds();
|
List<Long> defaultOrgIds = notifySendDTO.getOrgIds();
|
if (defaultEmpId != null) {
|
empIds.addAll(defaultEmpId);
|
}
|
if (defaultOrgIds != null) {
|
orgIds.addAll(defaultOrgIds);
|
}
|
List<Long> empIds2 = getNoticeEmpIds(orgIds, empIds);
|
log.info("发送消息,时间->{}", LocalDateTime.now());
|
this.notifyBusinessManager.send(dtoList, empIds2, data);
|
}
|
|
private void checkTemplate(NotifyTemplateEntity notifyTemplateEntity) {
|
long count = this.notifyTemplateService.count((Wrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().ne((v0) -> {
|
return v0.getId();
|
}, notifyTemplateEntity.getId())).eq((v0) -> {
|
return v0.getType();
|
}, notifyTemplateEntity.getType())).eq((v0) -> {
|
return v0.getBusiness();
|
}, notifyTemplateEntity.getBusiness()));
|
if (count > 0) {
|
throw new ServiceException(MessageUtils.message("notify.business.template.not.be.repeated", new Object[0]));
|
}
|
}
|
|
private void checkTemplateAndType(NotifyBusinessSaveVO business) {
|
long count = count((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery(BusinessNotify.class).ne(Func.isNotEmpty(business.getBusinessNotify().getId()), (v0) -> {
|
return v0.getId();
|
}, business.getBusinessNotify().getId()).eq((v0) -> {
|
return v0.getNotifyType();
|
}, business.getBusinessNotify().getNotifyType())).eq((v0) -> {
|
return v0.getBusinessKey();
|
}, business.getBusinessNotify().getBusinessKey()));
|
if (count > 0) {
|
throw new ServiceException(MessageUtils.message("notify.business.template.not.be.repeated", new Object[0]));
|
}
|
long typeCount = this.notifyConfigService.count((Wrapper) Wrappers.lambdaQuery().eq((v0) -> {
|
return v0.getType();
|
}, business.getBusinessNotify().getNotifyType()));
|
if (typeCount <= 0) {
|
throw new ServiceException(MessageUtils.message("notify.service.config.is.null", new Object[0]));
|
}
|
}
|
|
private void count(List<NotifyBusinessTreeVO> trees) {
|
for (NotifyBusinessTreeVO tree : trees) {
|
if (tree.getChildren() != null) {
|
for (NotifyBusinessTreeVO child : tree.getChildren()) {
|
child.setStartCount((Integer) child.getChildren().stream().map((v0) -> {
|
return v0.getStartCount();
|
}).reduce((v0, v1) -> {
|
return Integer.sum(v0, v1);
|
}).orElse(0));
|
}
|
tree.setStartCount((Integer) tree.getChildren().stream().map((v0) -> {
|
return v0.getStartCount();
|
}).reduce((v0, v1) -> {
|
return Integer.sum(v0, v1);
|
}).orElse(0));
|
}
|
}
|
}
|
}
|