Commit dea9f6258ac407fe36821cf65508f54d8e9ab96d
1 parent
2656cba3
fix: 发送通知时,选择一个根组织,通知一个用户通知了两次【原因:没有去除重复的组织ID、重复的用户ID】
Showing
4 changed files
with
8 additions
and
6 deletions
... | ... | @@ -33,7 +33,7 @@ public class YtAlarmNoticeController { |
33 | 33 | private final YtNoticeService service; |
34 | 34 | |
35 | 35 | @PostMapping("/alert") |
36 | - public void alermNotice(@RequestParam(value = "token", required = true) String token, | |
36 | + public void alertNotice(@RequestParam(value = "token", required = true) String token, | |
37 | 37 | @RequestBody AlarmInfoDTO alarmInfo) { |
38 | 38 | Assert.notNull(token, "token cannot be null"); |
39 | 39 | Assert.notNull(alarmInfo, "alarm info cannot be null"); | ... | ... |
... | ... | @@ -142,8 +142,7 @@ public class SysNoticeServiceImpl extends AbstractBaseService<SysNoticeMapper, S |
142 | 142 | } |
143 | 143 | sysNotice.setCreator(currentUserId); |
144 | 144 | sysNotice.setSenderDate(LocalDateTime.now()); |
145 | - int update = | |
146 | - baseMapper.update( | |
145 | + baseMapper.update( | |
147 | 146 | sysNotice, |
148 | 147 | new LambdaQueryWrapper<SysNotice>() |
149 | 148 | .eq(SysNotice::getId, sysNoticeDTO.getId()) | ... | ... |
... | ... | @@ -17,7 +17,9 @@ import org.thingsboard.server.dao.yunteng.mapper.UserOrganizationMappingMapper; |
17 | 17 | import org.thingsboard.server.dao.yunteng.service.UserOrganizationMappingService; |
18 | 18 | |
19 | 19 | import java.util.ArrayList; |
20 | +import java.util.HashSet; | |
20 | 21 | import java.util.List; |
22 | +import java.util.Set; | |
21 | 23 | import java.util.stream.Collectors; |
22 | 24 | |
23 | 25 | /** |
... | ... | @@ -42,13 +44,15 @@ public class UserOrganizationMappingServiceImpl implements UserOrganizationMappi |
42 | 44 | if (ObjectUtils.isEmpty(collect)) { |
43 | 45 | return new ArrayList<>(); |
44 | 46 | } else { |
47 | + Set<String> clearList = new HashSet<>(); | |
48 | + clearList.addAll(collect); | |
45 | 49 | return userOrganizationMappingMapper |
46 | 50 | .selectList( |
47 | 51 | new LambdaQueryWrapper<UserOrganizationMapping>() |
48 | - .in(UserOrganizationMapping::getOrganizationId, collect)) | |
52 | + .in(UserOrganizationMapping::getOrganizationId, clearList)) | |
49 | 53 | .stream() |
50 | - .distinct() | |
51 | 54 | .map(UserOrganizationMapping::getUserId) |
55 | + .distinct() | |
52 | 56 | .collect(Collectors.toList()); |
53 | 57 | } |
54 | 58 | } | ... | ... |
... | ... | @@ -16,7 +16,6 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; |
16 | 16 | import org.thingsboard.server.dao.yunteng.entities.AlarmContact; |
17 | 17 | import org.thingsboard.server.dao.yunteng.mapper.AlarmContactMapper; |
18 | 18 | import org.thingsboard.server.dao.yunteng.mapper.OrganizationMapper; |
19 | -import org.thingsboard.server.dao.yunteng.mapper.UserOrganizationMappingMapper; | |
20 | 19 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; |
21 | 20 | import org.thingsboard.server.dao.yunteng.service.UserOrganizationMappingService; |
22 | 21 | import org.thingsboard.server.dao.yunteng.service.YtAlarmContactService; | ... | ... |