Commit de148a4e8c9b8de4244a594cf73d0cef305e4382

Authored by xp.Huang
2 parents a0f98e83 fdb2dd16

Merge branch '20220908' into 'master'

fix: 小程序统计接口异常问题修复

See merge request huang/thingsboard3.3.2!129
... ... @@ -23,7 +23,7 @@ public enum ErrorMessage {
23 23 PROVIDE_CORRECT_PHONE_NUMBER(400004,"请提供正确的电话号码"),
24 24 PROVIDE_CORRECT_EMAIL(400005,"请提供正确的邮箱"),
25 25 PHONE_NUMBER_OR_EMAIL_REQUIRED(400006,"必须提供电话或者邮箱"),
26   - NAME_ALREADY_EXISTS(400007,"名称已存在"),
  26 + NAME_ALREADY_EXISTS(400007,"名称已被使用"),
27 27 ROLE_IN_USE(400008,"该角色还存在用户使用"),
28 28 NONE_DEFAULT_RULE_CHAIN(400009,"该租户不存在默认的规则链"),
29 29 TENANT_MISMATCHING(400010,"租户不匹配"),
... ... @@ -67,7 +67,7 @@ public enum ErrorMessage {
67 67 VIDEO_PLATFORM_CONFIG_LACK(400047,"流媒体平台信息缺失"),
68 68 VIDEO_PLATFORM_CONFIG_ERROR(400048,"流媒体平台信息配置有误"),
69 69 VIDEO_PLATFORM_NEED_ENABLE_HLS_HTTPS(400049,"平台需开启https的hls协议"),
70   - NAME_EXISTED(400050,"名称【%s】已存在"),
  70 + NAME_EXISTED(400050,"名称【%s】已被使用"),
71 71 INVALID_PARAMETER_OR_NOT_MATCH_TENANT(400051,"参数错误或该条数据不属于当前租户"),
72 72 CRON_INVALID(400052,"cron表达式无效"),
73 73 EXPORT_CONFIG_NON_EXISTENT(400053,"报表配置不存在或已被删除"),
... ...
... ... @@ -36,6 +36,8 @@ import org.thingsboard.server.common.data.id.DeviceProfileId;
36 36 import org.thingsboard.server.common.data.id.TenantId;
37 37 import org.thingsboard.server.common.data.page.PageData;
38 38 import org.thingsboard.server.common.data.page.PageLink;
  39 +import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException;
  40 +import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage;
39 41 import org.thingsboard.server.dao.entity.AbstractEntityService;
40 42 import org.thingsboard.server.dao.exception.DataValidationException;
41 43 import org.thingsboard.server.dao.service.DataValidator;
... ... @@ -112,7 +114,7 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D
112 114 } catch (Exception t) {
113 115 ConstraintViolationException e = extractConstraintViolationException(t).orElse(null);
114 116 if (e != null && e.getConstraintName() != null && e.getConstraintName().equalsIgnoreCase("device_profile_name_unq_key")) {
115   - throw new DataValidationException("Device profile with such name already exists!");
  117 + throw new YtDataValidationException(ErrorMessage.NAME_ALREADY_EXISTS.getMessage());
116 118 } else if (e != null && e.getConstraintName() != null && e.getConstraintName().equalsIgnoreCase("device_provision_key_unq_key")) {
117 119 throw new DataValidationException("Device profile with such provision device key already exists!");
118 120 } else {
... ...
... ... @@ -174,7 +174,7 @@ public class HomePageServiceImpl implements HomePageService {
174 174 }else{
175 175 totalExpired.getAndIncrement();
176 176 }
177   - if(endTime.isAfter(customer.getUpdateTime()) && startTime.isBefore(customer.getUpdateTime())){
  177 + if(customer.getUpdateTime() != null && endTime.isAfter(customer.getUpdateTime()) && startTime.isBefore(customer.getUpdateTime())){
178 178 totalActivity.incrementAndGet();
179 179 }
180 180
... ...
... ... @@ -380,8 +380,8 @@
380 380 <select id="findDeviceKeys" resultType="string">
381 381 SELECT
382 382 DISTINCT base.key as keyName
383   - FROM ts_kv_latest latest
384   - LEFT JOIN ts_kv_dictionary base ON latest.key = base.key_id
  383 + FROM ts_kv_dictionary base
  384 + LEFT JOIN ts_kv_latest latest ON latest.key = base.key_id
385 385 LEFT JOIN device tb ON tb.ID = latest.entity_id
386 386 LEFT JOIN iotfs_device iot ON tb.ID :: TEXT = iot.tb_device_id
387 387 <where>
... ...