Commit f58f3e56882baa29636ad92ce1c3dbd2766081b4
Merge branch '20220420' into 'master'
fix: 告警分页信息 See merge request huang/thingsboard3.3.2!82
Showing
14 changed files
with
329 additions
and
8 deletions
@@ -49,7 +49,7 @@ public class YtAlarmInfoController extends BaseController { | @@ -49,7 +49,7 @@ public class YtAlarmInfoController extends BaseController { | ||
49 | public YtPageData<YtAlarmEntity> pageAlarmInfo( | 49 | public YtPageData<YtAlarmEntity> pageAlarmInfo( |
50 | @RequestParam(PAGE_SIZE) int pageSize, | 50 | @RequestParam(PAGE_SIZE) int pageSize, |
51 | @RequestParam(PAGE) int page, | 51 | @RequestParam(PAGE) int page, |
52 | - @RequestParam(value = "status", required = false) AlarmStatus status, | 52 | + @RequestParam(value = "status", required = false) List<AlarmStatus> status, |
53 | @RequestParam(value = "textSearch", required = false) String textSearch, | 53 | @RequestParam(value = "textSearch", required = false) String textSearch, |
54 | @RequestParam(value = "alarmType", required = false) String alarmType, | 54 | @RequestParam(value = "alarmType", required = false) String alarmType, |
55 | @RequestParam(value = "organizationId", required = false) String organizationId, | 55 | @RequestParam(value = "organizationId", required = false) String organizationId, |
application/src/main/java/org/thingsboard/server/controller/yunteng/YtThirdPlatformController.java
0 → 100644
1 | +package org.thingsboard.server.controller.yunteng; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
4 | +import io.swagger.annotations.Api; | ||
5 | +import io.swagger.annotations.ApiOperation; | ||
6 | +import lombok.RequiredArgsConstructor; | ||
7 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
8 | +import org.springframework.validation.annotation.Validated; | ||
9 | +import org.springframework.web.bind.annotation.*; | ||
10 | +import org.thingsboard.server.common.data.exception.ThingsboardException; | ||
11 | +import org.thingsboard.server.common.data.yunteng.common.DeleteGroup; | ||
12 | +import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | ||
13 | +import org.thingsboard.server.common.data.yunteng.dto.YtOpinionDTO; | ||
14 | +import org.thingsboard.server.common.data.yunteng.dto.YtThirdUserDTO; | ||
15 | +import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | ||
16 | +import org.thingsboard.server.common.data.yunteng.enums.ThirdPlatformEnum; | ||
17 | +import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; | ||
18 | +import org.thingsboard.server.controller.BaseController; | ||
19 | +import org.thingsboard.server.dao.yunteng.entities.YtOpinionEntity; | ||
20 | +import org.thingsboard.server.dao.yunteng.entities.YtThirdUserEntity; | ||
21 | +import org.thingsboard.server.dao.yunteng.service.YtOpinionService; | ||
22 | +import org.thingsboard.server.dao.yunteng.service.YtThirdPlatformService; | ||
23 | + | ||
24 | +import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | ||
25 | + | ||
26 | +/** | ||
27 | + * @author Administrator | ||
28 | + */ | ||
29 | +@RestController | ||
30 | +@RequestMapping("api/yt/third") | ||
31 | +@Api(tags = {"第三方小程序"}) | ||
32 | +@RequiredArgsConstructor | ||
33 | +public class YtThirdPlatformController extends BaseController { | ||
34 | + | ||
35 | + private final YtThirdPlatformService thirdService; | ||
36 | + | ||
37 | + @GetMapping(params = {PAGE_SIZE, PAGE}) | ||
38 | + @ApiOperation("分页") | ||
39 | + public YtPageData<YtThirdUserDTO> pageAlarmProfile( | ||
40 | + @RequestParam(PAGE_SIZE) int pageSize, | ||
41 | + @RequestParam(PAGE) int page, | ||
42 | + @RequestParam(value = "platformName", required = false) ThirdPlatformEnum platformName, | ||
43 | + @RequestParam(value = "name", required = false) String name, | ||
44 | + @RequestParam(value = ORDER_FILED, required = false) String orderBy, | ||
45 | + @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) | ||
46 | + throws ThingsboardException { | ||
47 | + | ||
48 | + | ||
49 | + IPage<YtThirdUserEntity> pageInfrom = thirdService.getPage(page, pageSize, orderBy, orderType); | ||
50 | + return thirdService.pageDatas(pageInfrom,platformName,name); | ||
51 | + } | ||
52 | + | ||
53 | + @PostMapping | ||
54 | + @ApiOperation("绑定|编辑") | ||
55 | + public YtThirdUserDTO saveOrUpdateAlarmProfile( | ||
56 | + @Validated @RequestBody YtThirdUserDTO dto) throws ThingsboardException { | ||
57 | + return thirdService.saveOrUpdate(dto); | ||
58 | + } | ||
59 | + | ||
60 | + @DeleteMapping | ||
61 | + @ApiOperation("删除") | ||
62 | + public boolean deleteAlarmProfile(@Validated(DeleteGroup.class) @RequestBody DeleteDTO deleteDTO) | ||
63 | + throws ThingsboardException { | ||
64 | + deleteDTO.setTenantId(getCurrentUser().getCurrentTenantId()); | ||
65 | + return thirdService.deleteDataByIds(deleteDTO); | ||
66 | + } | ||
67 | + | ||
68 | + | ||
69 | +} |
@@ -78,6 +78,8 @@ public final class ModelConstants { | @@ -78,6 +78,8 @@ public final class ModelConstants { | ||
78 | public static final String IOTFS_VIDEO_STREAM_TABLE_NAME = "iotfs_device_camera"; | 78 | public static final String IOTFS_VIDEO_STREAM_TABLE_NAME = "iotfs_device_camera"; |
79 | /** 意见反馈 */ | 79 | /** 意见反馈 */ |
80 | public static final String IOTFS_OPINION_TABLE_NAME = "iotfs_opinion"; | 80 | public static final String IOTFS_OPINION_TABLE_NAME = "iotfs_opinion"; |
81 | + /** 意见反馈 */ | ||
82 | + public static final String IOTFS_THIRD_USER_TABLE_NAME = "iotfs_third_user"; | ||
81 | } | 83 | } |
82 | 84 | ||
83 | public static class TableFields { | 85 | public static class TableFields { |
common/data/src/main/java/org/thingsboard/server/common/data/yunteng/dto/YtThirdUserDTO.java
0 → 100644
1 | +package org.thingsboard.server.common.data.yunteng.dto; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModelProperty; | ||
4 | +import lombok.Data; | ||
5 | +import lombok.EqualsAndHashCode; | ||
6 | +import org.thingsboard.server.common.data.yunteng.enums.ThirdPlatformEnum; | ||
7 | + | ||
8 | +import javax.validation.constraints.NotEmpty; | ||
9 | + | ||
10 | +/** | ||
11 | + * @author Administrator | ||
12 | + */ | ||
13 | +@Data | ||
14 | +@EqualsAndHashCode(callSuper = true) | ||
15 | +public class YtThirdUserDTO extends BaseDTO { | ||
16 | + | ||
17 | + @ApiModelProperty(value = "第三方平台", required = true) | ||
18 | + private ThirdPlatformEnum platformName; | ||
19 | + | ||
20 | + @ApiModelProperty(value = "第三方平台用户ID", required = true) | ||
21 | + @NotEmpty(message = "第三方平台用户ID不能为空") | ||
22 | + private String thirdUserId; | ||
23 | + | ||
24 | + @ApiModelProperty(value = "用户昵称", required = false) | ||
25 | + private String nickName; | ||
26 | + @ApiModelProperty(value = "用户头像", required = false) | ||
27 | + private String avatarUrl; | ||
28 | + | ||
29 | + @ApiModelProperty(value = "系统用户ID", required = true) | ||
30 | + @NotEmpty(message = "系统用户ID不能为空") | ||
31 | + private String appUserId; | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | +} |
@@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableField; | @@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableField; | ||
4 | import com.baomidou.mybatisplus.annotation.TableId; | 4 | import com.baomidou.mybatisplus.annotation.TableId; |
5 | import com.baomidou.mybatisplus.annotation.TableName; | 5 | import com.baomidou.mybatisplus.annotation.TableName; |
6 | import com.fasterxml.jackson.databind.JsonNode; | 6 | import com.fasterxml.jackson.databind.JsonNode; |
7 | +import io.swagger.annotations.ApiModelProperty; | ||
7 | import lombok.Data; | 8 | import lombok.Data; |
8 | import org.thingsboard.server.common.data.alarm.AlarmSeverity; | 9 | import org.thingsboard.server.common.data.alarm.AlarmSeverity; |
9 | import org.thingsboard.server.common.data.alarm.AlarmStatus; | 10 | import org.thingsboard.server.common.data.alarm.AlarmStatus; |
10 | import org.thingsboard.server.common.data.yunteng.utils.YtDateTimeUtils; | 11 | import org.thingsboard.server.common.data.yunteng.utils.YtDateTimeUtils; |
11 | 12 | ||
13 | +import javax.validation.constraints.NotEmpty; | ||
12 | import java.util.UUID; | 14 | import java.util.UUID; |
13 | 15 | ||
14 | import static org.thingsboard.server.dao.model.ModelConstants.ALARM_COLUMN_FAMILY_NAME; | 16 | import static org.thingsboard.server.dao.model.ModelConstants.ALARM_COLUMN_FAMILY_NAME; |
@@ -78,6 +80,8 @@ public class YtAlarmEntity { | @@ -78,6 +80,8 @@ public class YtAlarmEntity { | ||
78 | @TableField() | 80 | @TableField() |
79 | private String propagateRelationTypes; | 81 | private String propagateRelationTypes; |
80 | 82 | ||
83 | + private String organizationId; | ||
84 | + private String organizationName; | ||
81 | 85 | ||
82 | public String getStartTs() { | 86 | public String getStartTs() { |
83 | return YtDateTimeUtils.formate(this.startTs); | 87 | return YtDateTimeUtils.formate(this.startTs); |
1 | +package org.thingsboard.server.dao.yunteng.entities; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
4 | +import io.swagger.annotations.ApiModelProperty; | ||
5 | +import lombok.Data; | ||
6 | +import lombok.EqualsAndHashCode; | ||
7 | +import org.thingsboard.server.common.data.yunteng.constant.ModelConstants; | ||
8 | +import org.thingsboard.server.common.data.yunteng.enums.ThirdPlatformEnum; | ||
9 | + | ||
10 | +import javax.validation.constraints.NotEmpty; | ||
11 | + | ||
12 | +/** | ||
13 | + * @author Administrator | ||
14 | + */ | ||
15 | +@Data | ||
16 | +@EqualsAndHashCode(callSuper = true) | ||
17 | +@TableName(ModelConstants.Table.IOTFS_THIRD_USER_TABLE_NAME) | ||
18 | +public class YtThirdUserEntity extends BaseEntity { | ||
19 | + | ||
20 | + private ThirdPlatformEnum platformName; | ||
21 | + private String thirdUserId; | ||
22 | + private String nickName; | ||
23 | + private String avatarUrl; | ||
24 | + private String appUserId; | ||
25 | + | ||
26 | +} |
@@ -42,11 +42,11 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService { | @@ -42,11 +42,11 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService { | ||
42 | private final YtAlarmMapper ytJpaAarmDao; | 42 | private final YtAlarmMapper ytJpaAarmDao; |
43 | private final OrganizationMapper organizationMapper; | 43 | private final OrganizationMapper organizationMapper; |
44 | @Override | 44 | @Override |
45 | - public YtPageData<YtAlarmEntity> alarmPage(Map<String, Object> pageMap, TenantId tenantId, String alarmType, Long startTime, Long endTime, AlarmStatus status, String deviceId, DeviceTypeEnum deviceType, EntityType originatorType, String organizationId) { | 45 | + public YtPageData<YtAlarmEntity> alarmPage(Map<String, Object> pageMap, TenantId tenantId, String alarmType, Long startTime, Long endTime, List<AlarmStatus> status, String deviceId, DeviceTypeEnum deviceType, EntityType originatorType, String organizationId) { |
46 | IPage<YtAlarmEntity> page= getPage(pageMap, ModelConstants.CREATED_TIME_PROPERTY,false); | 46 | IPage<YtAlarmEntity> page= getPage(pageMap, ModelConstants.CREATED_TIME_PROPERTY,false); |
47 | List<String> ids =new ArrayList<>(); | 47 | List<String> ids =new ArrayList<>(); |
48 | if(StringUtils.isNotBlank(organizationId)){ | 48 | if(StringUtils.isNotBlank(organizationId)){ |
49 | - Collection filter = Collections.emptyList(); | 49 | + List<String> filter = new ArrayList<>(); |
50 | filter.add(organizationId); | 50 | filter.add(organizationId); |
51 | List<OrganizationDTO> all =organizationMapper.findOrganizationTreeList(tenantId.getId().toString(),filter); | 51 | List<OrganizationDTO> all =organizationMapper.findOrganizationTreeList(tenantId.getId().toString(),filter); |
52 | for(OrganizationDTO item:all){ | 52 | for(OrganizationDTO item:all){ |
dao/src/main/java/org/thingsboard/server/dao/yunteng/impl/YtThirdPlatformServiceImpl.java
0 → 100644
1 | +package org.thingsboard.server.dao.yunteng.impl; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||
4 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
5 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
6 | +import com.fasterxml.jackson.databind.JsonNode; | ||
7 | +import lombok.RequiredArgsConstructor; | ||
8 | +import lombok.extern.slf4j.Slf4j; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | +import org.springframework.transaction.annotation.Transactional; | ||
11 | +import org.thingsboard.server.common.data.StringUtils; | ||
12 | +import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException; | ||
13 | +import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | ||
14 | +import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | ||
15 | +import org.thingsboard.server.common.data.yunteng.dto.YtOpinionDTO; | ||
16 | +import org.thingsboard.server.common.data.yunteng.dto.YtThirdUserDTO; | ||
17 | +import org.thingsboard.server.common.data.yunteng.enums.ThirdPlatformEnum; | ||
18 | +import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; | ||
19 | +import org.thingsboard.server.dao.yunteng.entities.User; | ||
20 | +import org.thingsboard.server.dao.yunteng.entities.YtOpinionEntity; | ||
21 | +import org.thingsboard.server.dao.yunteng.entities.YtThirdUserEntity; | ||
22 | +import org.thingsboard.server.dao.yunteng.mapper.UserMapper; | ||
23 | +import org.thingsboard.server.dao.yunteng.mapper.YtOpinionMapper; | ||
24 | +import org.thingsboard.server.dao.yunteng.mapper.YtThirdPlatformMapper; | ||
25 | +import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; | ||
26 | +import org.thingsboard.server.dao.yunteng.service.UserOrganizationMappingService; | ||
27 | +import org.thingsboard.server.dao.yunteng.service.YtOpinionService; | ||
28 | +import org.thingsboard.server.dao.yunteng.service.YtThirdPlatformService; | ||
29 | + | ||
30 | +import java.util.List; | ||
31 | + | ||
32 | +@Slf4j | ||
33 | +@Service | ||
34 | +@RequiredArgsConstructor | ||
35 | +public class YtThirdPlatformServiceImpl extends AbstractBaseService<YtThirdPlatformMapper, YtThirdUserEntity> | ||
36 | + implements YtThirdPlatformService { | ||
37 | + | ||
38 | + private final UserMapper userMapper; | ||
39 | + | ||
40 | + @Override | ||
41 | + public YtPageData<YtThirdUserDTO> pageDatas(IPage<YtThirdUserEntity> pageInfrom, ThirdPlatformEnum platformName, String name) { | ||
42 | + Wrapper pageFilter = new QueryWrapper<YtThirdUserEntity>() | ||
43 | + .lambda() | ||
44 | + .eq(pageInfrom != null,YtThirdUserEntity::getPlatformName,platformName) | ||
45 | + .like(StringUtils.isNotEmpty(name),YtThirdUserEntity::getNickName,name); | ||
46 | + IPage<YtThirdUserEntity> page = baseMapper.selectPage(pageInfrom, pageFilter); | ||
47 | + return getPageData(page, YtThirdUserDTO.class); | ||
48 | + } | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + @Override | ||
55 | + @Transactional(rollbackFor=Exception.class) | ||
56 | + public YtThirdUserDTO saveOrUpdate(YtThirdUserDTO videoDTO) { | ||
57 | + User user = userMapper.selectById(videoDTO.getAppUserId()); | ||
58 | + if(user == null){ | ||
59 | + throw new YtDataValidationException(ErrorMessage.USER_NOT_EXISTS.getMessage()); | ||
60 | + } | ||
61 | + if(StringUtils.isEmpty(user.getAvatar()) && StringUtils.isNotEmpty(videoDTO.getAvatarUrl())){ | ||
62 | + user.setAvatar(videoDTO.getAvatarUrl()); | ||
63 | + userMapper.updateById(user); | ||
64 | + } | ||
65 | + Wrapper filter = new QueryWrapper<YtThirdUserEntity>().lambda() | ||
66 | + .eq(YtThirdUserEntity::getThirdUserId,videoDTO.getThirdUserId()); | ||
67 | + YtThirdUserEntity oldVideo = baseMapper.selectOne(filter); | ||
68 | + if (null == oldVideo) { | ||
69 | + baseMapper.insert(videoDTO.getEntity(YtThirdUserEntity.class)); | ||
70 | + }else { | ||
71 | + videoDTO.setId(oldVideo.getId()); | ||
72 | + baseMapper.updateById(videoDTO.getEntity(YtThirdUserEntity.class)); | ||
73 | + } | ||
74 | + return videoDTO; | ||
75 | + } | ||
76 | + | ||
77 | + | ||
78 | + | ||
79 | + @Override | ||
80 | + @Transactional(rollbackFor=Exception.class) | ||
81 | + public boolean deleteDataByIds(DeleteDTO deleteDTO) { | ||
82 | + Wrapper filter = new QueryWrapper<YtThirdUserEntity>().lambda() | ||
83 | + .in(YtThirdUserEntity::getId,deleteDTO.getIds()); | ||
84 | + return baseMapper.delete(filter) > 0; | ||
85 | + } | ||
86 | + | ||
87 | + | ||
88 | + @Override | ||
89 | + public String accessToken(String appKey, String appSecret) { | ||
90 | + return null; | ||
91 | + } | ||
92 | + | ||
93 | + @Override | ||
94 | + public JsonNode message(String receiver, JsonNode message) { | ||
95 | + return null; | ||
96 | + } | ||
97 | +} |
@@ -28,7 +28,7 @@ public interface YtAlarmMapper extends BaseMapper<YtAlarmEntity> { | @@ -28,7 +28,7 @@ public interface YtAlarmMapper extends BaseMapper<YtAlarmEntity> { | ||
28 | ,@Param("alarmType")String alarmType | 28 | ,@Param("alarmType")String alarmType |
29 | ,@Param("startTime")Long startTime | 29 | ,@Param("startTime")Long startTime |
30 | ,@Param("endTime")Long endTime | 30 | ,@Param("endTime")Long endTime |
31 | - ,@Param("status")AlarmStatus status | 31 | + ,@Param("status")List<AlarmStatus> status |
32 | ,@Param("deviceId")String deviceId | 32 | ,@Param("deviceId")String deviceId |
33 | ,@Param("deviceType") DeviceTypeEnum deviceType | 33 | ,@Param("deviceType") DeviceTypeEnum deviceType |
34 | ,@Param("originatorType") EntityType originatorType | 34 | ,@Param("originatorType") EntityType originatorType |
1 | +package org.thingsboard.server.dao.yunteng.mapper; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
4 | +import org.apache.ibatis.annotations.Mapper; | ||
5 | +import org.thingsboard.server.dao.yunteng.entities.YtThirdUserEntity; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author Administrator | ||
9 | + */ | ||
10 | +@Mapper | ||
11 | +public interface YtThirdPlatformMapper extends BaseMapper<YtThirdUserEntity> { | ||
12 | +} |
@@ -35,7 +35,7 @@ public interface YtAlarmInfoService { | @@ -35,7 +35,7 @@ public interface YtAlarmInfoService { | ||
35 | * @param organizationId 告警所属组织 | 35 | * @param organizationId 告警所属组织 |
36 | * @return | 36 | * @return |
37 | */ | 37 | */ |
38 | - YtPageData<YtAlarmEntity> alarmPage(Map<String, Object> pageMap, TenantId tenantId, String alarmType, Long startTime, Long endTime, AlarmStatus status, String deviceId, DeviceTypeEnum deviceType, EntityType originatorType, String organizationId); | 38 | + YtPageData<YtAlarmEntity> alarmPage(Map<String, Object> pageMap, TenantId tenantId, String alarmType, Long startTime, Long endTime, List<AlarmStatus> status, String deviceId, DeviceTypeEnum deviceType, EntityType originatorType, String organizationId); |
39 | 39 | ||
40 | 40 | ||
41 | /** | 41 | /** |
1 | +package org.thingsboard.server.dao.yunteng.service; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
4 | +import com.fasterxml.jackson.databind.JsonNode; | ||
5 | +import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | ||
6 | +import org.thingsboard.server.common.data.yunteng.dto.YtOpinionDTO; | ||
7 | +import org.thingsboard.server.common.data.yunteng.dto.YtThirdUserDTO; | ||
8 | +import org.thingsboard.server.common.data.yunteng.enums.ThirdPlatformEnum; | ||
9 | +import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; | ||
10 | +import org.thingsboard.server.dao.yunteng.entities.YtOpinionEntity; | ||
11 | +import org.thingsboard.server.dao.yunteng.entities.YtThirdUserEntity; | ||
12 | + | ||
13 | +/** | ||
14 | + * 第三方平台用户管理相关接口 | ||
15 | + * 例如:微信小程序、钉钉等。 | ||
16 | + * @author Administrator | ||
17 | + */ | ||
18 | +public interface YtThirdPlatformService extends BaseService<YtThirdUserEntity> { | ||
19 | + | ||
20 | + /** | ||
21 | + * @param pageInfrom 分页配置信息 | ||
22 | + * @param name 第三方平台用户昵称 | ||
23 | + * @return | ||
24 | + */ | ||
25 | + YtPageData<YtThirdUserDTO> pageDatas(IPage<YtThirdUserEntity> pageInfrom, ThirdPlatformEnum platformName,String name); | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + /** 第三方平台用户与系统用户绑定 | ||
30 | + * @param dto | ||
31 | + * @return | ||
32 | + */ | ||
33 | + YtThirdUserDTO saveOrUpdate(YtThirdUserDTO dto); | ||
34 | + | ||
35 | + /** | ||
36 | + * @param deleteDTO | ||
37 | + * @return | ||
38 | + */ | ||
39 | + boolean deleteDataByIds(DeleteDTO deleteDTO); | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + /** | ||
45 | + * 访问令牌 | ||
46 | + * @param appKey | ||
47 | + * @param appSecret | ||
48 | + * @return | ||
49 | + */ | ||
50 | + String accessToken(String appKey, String appSecret); | ||
51 | + | ||
52 | + /** | ||
53 | + * 推送第三方程序消息 | ||
54 | + * @param receiver | ||
55 | + * @param message | ||
56 | + * @return | ||
57 | + */ | ||
58 | + JsonNode message(String receiver,JsonNode message); | ||
59 | + | ||
60 | +} |
@@ -20,6 +20,9 @@ | @@ -20,6 +20,9 @@ | ||
20 | <result property="clearTs" column="clear_ts"/> | 20 | <result property="clearTs" column="clear_ts"/> |
21 | <result property="details" column="additional_info" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | 21 | <result property="details" column="additional_info" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> |
22 | <result property="propagate" column="propagate"/> | 22 | <result property="propagate" column="propagate"/> |
23 | + <result property="organizationId" column="organization_id"/> | ||
24 | + <result property="organizationName" column="organization_name"/> | ||
25 | + | ||
23 | </resultMap> | 26 | </resultMap> |
24 | 27 | ||
25 | <resultMap type="org.thingsboard.server.dao.yunteng.entities.SysDict" id="alarmType"> | 28 | <resultMap type="org.thingsboard.server.dao.yunteng.entities.SysDict" id="alarmType"> |
@@ -34,8 +37,10 @@ | @@ -34,8 +37,10 @@ | ||
34 | 37 | ||
35 | 38 | ||
36 | <select id="alarmPage" resultMap="alarmInfo"> | 39 | <select id="alarmPage" resultMap="alarmInfo"> |
37 | - SELECT d.name AS device_name,d.id device_id,m.* | ||
38 | - FROM alarm m LEFT JOIN iotfs_device d ON m.originator_id = d.tb_device_id::uuid | 40 | + SELECT d.name AS device_name,d.id device_id,m.*,d.organization_id,org.name organization_name |
41 | + FROM alarm m | ||
42 | + LEFT JOIN iotfs_device d ON m.originator_id = d.tb_device_id::uuid | ||
43 | + LEFT JOIN iotfs_organization org ON org.id = d.organization_id | ||
39 | <where> | 44 | <where> |
40 | m.tenant_id = #{tenantId} | 45 | m.tenant_id = #{tenantId} |
41 | <if test="alarmType!=null"> | 46 | <if test="alarmType!=null"> |
@@ -48,7 +53,10 @@ | @@ -48,7 +53,10 @@ | ||
48 | AND created_time <= #{endTime} | 53 | AND created_time <= #{endTime} |
49 | </if> | 54 | </if> |
50 | <if test="status!=null"> | 55 | <if test="status!=null"> |
51 | - AND status = #{status.name} | 56 | + AND status IN |
57 | + <foreach collection="status" item="id" index="index" open="(" close=")" separator=","> | ||
58 | + #{id} | ||
59 | + </foreach> | ||
52 | </if> | 60 | </if> |
53 | <if test="deviceId!=null"> | 61 | <if test="deviceId!=null"> |
54 | AND d.id = #{deviceId} | 62 | AND d.id = #{deviceId} |