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.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import java.lang.invoke.SerializedLambda; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import com.qianwen.smartman.common.cache.RegionCache; import com.qianwen.smartman.common.constant.DictConstant; import com.qianwen.smartman.common.utils.ExtraLambdaQueryWrapper; import com.qianwen.smartman.common.utils.Lambda; import com.qianwen.smartman.common.utils.MessageUtils; import com.qianwen.core.log.exception.ServiceException; import com.qianwen.core.mp.base.BaseServiceImpl; import com.qianwen.core.secure.utils.AuthUtil; import com.qianwen.core.tool.utils.Func; import com.qianwen.smartman.modules.notify.convert.NotifySystemConvert; import com.qianwen.smartman.modules.notify.entity.Notice; import com.qianwen.smartman.modules.notify.entity.NotifySystem; import com.qianwen.smartman.modules.notify.mapper.NotifySystemMapper; import com.qianwen.smartman.modules.notify.service.INoticeService; import com.qianwen.smartman.modules.notify.service.INotifySystemService; import com.qianwen.smartman.modules.notify.vo.NotifySystemSelectVO; import com.qianwen.smartman.modules.notify.vo.NotifySystemUnreadVO; import com.qianwen.smartman.modules.notify.vo.NotifySystemVO; import com.qianwen.smartman.modules.system.entity.Dict; 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; @Service /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/service/impl/NotifySystemServiceImpl.class */ public class NotifySystemServiceImpl extends BaseServiceImpl implements INotifySystemService { @Autowired @Lazy private INoticeService noticeService; @Autowired private IDictService dictService; private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { String implMethodName = lambda.getImplMethodName(); boolean z = true; switch (implMethodName.hashCode()) { case -1601031533: if (implMethodName.equals("getDictKey")) { z = false; break; } break; case -1462679124: if (implMethodName.equals("getNotifyTime")) { z = true; break; } break; case -1462663655: if (implMethodName.equals("getNotifyType")) { z = true; break; } break; case -1462639958: if (implMethodName.equals("getNotifyUser")) { z = true; break; } break; case -982980443: if (implMethodName.equals("getDictValue")) { z = true; break; } break; case -75622813: if (implMethodName.equals("getCode")) { 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getDictKey(); }; } 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getDictKey(); }; } 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getDictKey(); }; } 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getDictKey(); }; } 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/NotifySystem") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { 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/NotifySystem") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getNotifyUser(); }; } 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getDictValue(); }; } 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getDictValue(); }; } 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getDictValue(); }; } 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getCode(); }; } 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getCode(); }; } 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getCode(); }; } 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/modules/notify/entity/NotifySystem") && lambda.getImplMethodSignature().equals("()Ljava/util/Date;")) { return (v0) -> { return v0.getNotifyTime(); }; } break; } throw new IllegalArgumentException("Invalid lambda deserialization"); } @Override // org.springblade.modules.notify.service.INotifySystemService public NotifySystemUnreadVO getUnreadList() { List dicts = this.dictService.list((Wrapper) Wrappers.lambdaQuery().select(new SFunction[]{(v0) -> { return v0.getDictKey(); }, (v0) -> { return v0.getDictValue(); }}).eq((v0) -> { return v0.getCode(); }, DictConstant.NOTICE_CODE)); Map noticeDict = (Map) dicts.stream().collect(Collectors.toMap((v0) -> { return v0.getDictKey(); }, (v0) -> { return v0.getDictValue(); })); List notifySystems = ((NotifySystemMapper) this.baseMapper).getUnreadList(AuthUtil.getUserId()); if (Func.isEmpty(notifySystems)) { return new NotifySystemUnreadVO(); } if (Func.isNotEmpty(noticeDict)) { notifySystems = (List) notifySystems.stream().peek(o -> { o.setCategoryName((String) noticeDict.get(String.valueOf(o.getCategory()))); }).collect(Collectors.toList()); } List internalList = (List) notifySystems.stream().filter(o2 -> { return o2.getNotifyType().equals(1); }).collect(Collectors.toList()); List noticeList = (List) notifySystems.stream().filter(o3 -> { return o3.getNotifyType().equals(2); }).collect(Collectors.toList()); NotifySystemUnreadVO notifySystemUnreadVO = NotifySystemUnreadVO.builder().totalList(notifySystems).internalList(internalList).noticeList(noticeList).build(); return notifySystemUnreadVO; } @Override // org.springblade.modules.notify.service.INotifySystemService public IPage pageNotifySystem(NotifySystemSelectVO selectVO, IPage page) { Long userId = AuthUtil.getUserId(); Integer notifyType = selectVO.getNotifyType(); selectVO.setUserId(Func.toStr(userId)); if (Func.equals(1, notifyType)) { Wrapper wrapper = (Wrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> { return v0.getNotifyType(); }, 1)).eq((v0) -> { return v0.getNotifyUser(); }, userId)).orderByDesc((v0) -> { return v0.getNotifyTime(); }); return NotifySystemConvert.INSTANCE.convert(page(page, wrapper)); } else if (Func.equals(2, notifyType)) { IPage voPage = ((NotifySystemMapper) this.baseMapper).pageNotifySystem(selectVO, page); List records = voPage.getRecords(); List dicts = this.dictService.list((Wrapper) Wrappers.lambdaQuery().select(new SFunction[]{(v0) -> { return v0.getDictKey(); }, (v0) -> { return v0.getDictValue(); }}).eq((v0) -> { return v0.getCode(); }, DictConstant.NOTICE_CODE)); Map noticeDict = (Map) dicts.stream().collect(Collectors.toMap((v0) -> { return v0.getDictKey(); }, (v0) -> { return v0.getDictValue(); })); records.forEach(o -> { o.setCategoryName((String) noticeDict.get(String.valueOf(o.getCategory()))); }); return voPage; } else { return new Page(); } } @Override // org.springblade.modules.notify.service.INotifySystemService public NotifySystemVO detail(String id) { NotifySystem system = (NotifySystem) getById(id); Integer notifyType = system.getNotifyType(); NotifySystemVO systemVO = NotifySystemConvert.INSTANCE.convert(system); if (Func.equals(1, notifyType)) { return systemVO; } if (Func.equals(2, notifyType)) { String sourceId = system.getSourceId(); Notice notice = (Notice) this.noticeService.getById(Long.valueOf(sourceId)); if (Func.isEmpty(notice)) { throw new ServiceException(MessageUtils.message("notify.notice.already.delete", new Object[0])); } Integer category = notice.getCategory(); String content = notice.getContent(); Dict dict = (Dict) this.dictService.getOne(((ExtraLambdaQueryWrapper) ((ExtraLambdaQueryWrapper) Lambda.create().select((v0) -> { return v0.getDictKey(); }, (v0) -> { return v0.getDictValue(); }).eq((v0) -> { return v0.getCode(); }, DictConstant.NOTICE_CODE)).eq((v0) -> { return v0.getDictKey(); }, category.toString())).limit()); if (Func.isNotEmpty(dict)) { String dictValue = dict.getDictValue(); systemVO.setCategoryName(dictValue); } systemVO.setMessage(content); return systemVO; } return systemVO; } }