yangys
2024-03-27 e48aa2ac8dea1be5db11c63edf0b912c4ad5ce65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
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<NotifySystemMapper, NotifySystem> 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<Dict> 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<String, String> noticeDict = (Map) dicts.stream().collect(Collectors.toMap((v0) -> {
            return v0.getDictKey();
        }, (v0) -> {
            return v0.getDictValue();
        }));
        List<NotifySystemVO> 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<NotifySystemVO> internalList = (List) notifySystems.stream().filter(o2 -> {
            return o2.getNotifyType().equals(1);
        }).collect(Collectors.toList());
        List<NotifySystemVO> 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<NotifySystemVO> pageNotifySystem(NotifySystemSelectVO selectVO, IPage<NotifySystem> page) {
        Long userId = AuthUtil.getUserId();
        Integer notifyType = selectVO.getNotifyType();
        selectVO.setUserId(Func.toStr(userId));
        if (Func.equals(1, notifyType)) {
            Wrapper<NotifySystem> 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<NotifySystemVO> voPage = ((NotifySystemMapper) this.baseMapper).pageNotifySystem(selectVO, page);
            List<NotifySystemVO> records = voPage.getRecords();
            List<Dict> 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<String, String> 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;
    }
}