Commit e7607b4ce2ae32ef885d83c42dee91c651d5777b
1 parent
d5c41a53
fix: 修改大屏设计器、数据看板、组态分享后的数据,在编辑后会修改视图类型及访问凭证的bug
Showing
4 changed files
with
15 additions
and
13 deletions
@@ -10,7 +10,7 @@ public class PublicCustomerDTO extends TenantDTO { | @@ -10,7 +10,7 @@ public class PublicCustomerDTO extends TenantDTO { | ||
10 | private String publicId; | 10 | private String publicId; |
11 | 11 | ||
12 | @ApiModelProperty(value = "视图类型") | 12 | @ApiModelProperty(value = "视图类型") |
13 | - private ViewType viewType = ViewType.PRIVATE_VIEW; | 13 | + private ViewType viewType; |
14 | 14 | ||
15 | @ApiModelProperty(value = "访问凭证") | 15 | @ApiModelProperty(value = "访问凭证") |
16 | private String accessCredentials; | 16 | private String accessCredentials; |
@@ -73,6 +73,7 @@ public class TkConfigurationCenterServiceImpl | @@ -73,6 +73,7 @@ public class TkConfigurationCenterServiceImpl | ||
73 | public ConfigurationCenterDTO saveConfiguration(ConfigurationCenterDTO configurationCenterDTO) { | 73 | public ConfigurationCenterDTO saveConfiguration(ConfigurationCenterDTO configurationCenterDTO) { |
74 | TkConfigurationCenterEntity configurationCenter = | 74 | TkConfigurationCenterEntity configurationCenter = |
75 | configurationCenterDTO.getEntity(TkConfigurationCenterEntity.class); | 75 | configurationCenterDTO.getEntity(TkConfigurationCenterEntity.class); |
76 | + configurationCenter.setViewType(ViewType.PRIVATE_VIEW); | ||
76 | baseMapper.insert(configurationCenter); | 77 | baseMapper.insert(configurationCenter); |
77 | Integer type = FastIotConstants.PC_TYPE; | 78 | Integer type = FastIotConstants.PC_TYPE; |
78 | String defaultContent = | 79 | String defaultContent = |
@@ -102,6 +103,7 @@ public class TkConfigurationCenterServiceImpl | @@ -102,6 +103,7 @@ public class TkConfigurationCenterServiceImpl | ||
102 | if (!configurationCenter.getTenantId().equals(configurationCenterDTO.getTenantId())) { | 103 | if (!configurationCenter.getTenantId().equals(configurationCenterDTO.getTenantId())) { |
103 | throw new TkDataValidationException(ErrorMessage.TENANT_MISMATCHING.getMessage()); | 104 | throw new TkDataValidationException(ErrorMessage.TENANT_MISMATCHING.getMessage()); |
104 | } | 105 | } |
106 | + configurationCenterDTO.setAccessCredentials(configurationCenter.getAccessCredentials()); | ||
105 | baseMapper.updateById(configurationCenterDTO.getEntity(TkConfigurationCenterEntity.class)); | 107 | baseMapper.updateById(configurationCenterDTO.getEntity(TkConfigurationCenterEntity.class)); |
106 | return configurationCenterDTO; | 108 | return configurationCenterDTO; |
107 | } | 109 | } |
@@ -43,9 +43,7 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, | @@ -43,9 +43,7 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, | ||
43 | Optional.ofNullable(queryMap.get("tenantId")) | 43 | Optional.ofNullable(queryMap.get("tenantId")) |
44 | .map(Object::toString) | 44 | .map(Object::toString) |
45 | .orElseThrow( | 45 | .orElseThrow( |
46 | - () -> { | ||
47 | - throw new TkDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | ||
48 | - }); | 46 | + () -> new TkDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage())); |
49 | String organizationId = | 47 | String organizationId = |
50 | null != queryMap.get("organizationId") ? queryMap.get("organizationId").toString() : null; | 48 | null != queryMap.get("organizationId") ? queryMap.get("organizationId").toString() : null; |
51 | List<String> organizationIds = null; | 49 | List<String> organizationIds = null; |
@@ -83,10 +81,11 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, | @@ -83,10 +81,11 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, | ||
83 | @Transactional | 81 | @Transactional |
84 | public DataBoardDTO saveOrUpdateDataBoard(DataBoardDTO dataBoardDTO) { | 82 | public DataBoardDTO saveOrUpdateDataBoard(DataBoardDTO dataBoardDTO) { |
85 | TkDataBoardEntity dataBoard = dataBoardDTO.getEntity(TkDataBoardEntity.class); | 83 | TkDataBoardEntity dataBoard = dataBoardDTO.getEntity(TkDataBoardEntity.class); |
86 | - if(dataBoardDTO.getViewType().equals(ViewType.PRIVATE_VIEW)){ | 84 | + if(null != dataBoardDTO.getViewType() && dataBoardDTO.getViewType().equals(ViewType.PRIVATE_VIEW)){ |
87 | dataBoard.setAccessCredentials(null); | 85 | dataBoard.setAccessCredentials(null); |
88 | } | 86 | } |
89 | if (StringUtils.isEmpty(dataBoardDTO.getId())) { | 87 | if (StringUtils.isEmpty(dataBoardDTO.getId())) { |
88 | + dataBoard.setViewType(ViewType.PRIVATE_VIEW); | ||
90 | baseMapper.insert(dataBoard); | 89 | baseMapper.insert(dataBoard); |
91 | } else { | 90 | } else { |
92 | if (null != dataBoardDTO.getLayout() && !dataBoardDTO.getLayout().isEmpty()) { | 91 | if (null != dataBoardDTO.getLayout() && !dataBoardDTO.getLayout().isEmpty()) { |
@@ -98,11 +97,12 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, | @@ -98,11 +97,12 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, | ||
98 | .eq(TkDataBoardEntity::getId, dataBoardDTO.getId()) | 97 | .eq(TkDataBoardEntity::getId, dataBoardDTO.getId()) |
99 | .eq(TkDataBoardEntity::getTenantId, dataBoardDTO.getTenantId())); | 98 | .eq(TkDataBoardEntity::getTenantId, dataBoardDTO.getTenantId())); |
100 | Optional.ofNullable(board) | 99 | Optional.ofNullable(board) |
101 | - .map(obj -> baseMapper.updateById(dataBoard)) | 100 | + .map(obj -> { |
101 | + dataBoard.setAccessCredentials(obj.getAccessCredentials()); | ||
102 | + return baseMapper.updateById(dataBoard); | ||
103 | + }) | ||
102 | .orElseThrow( | 104 | .orElseThrow( |
103 | - () -> { | ||
104 | - throw new TkDataValidationException(ErrorMessage.INTERNAL_ERROR.getMessage()); | ||
105 | - }); | 105 | + () -> new TkDataValidationException(ErrorMessage.INTERNAL_ERROR.getMessage())); |
106 | } | 106 | } |
107 | return dataBoard.getDTO(DataBoardDTO.class); | 107 | return dataBoard.getDTO(DataBoardDTO.class); |
108 | } | 108 | } |
@@ -138,10 +138,8 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, | @@ -138,10 +138,8 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, | ||
138 | return baseMapper.updateById(dataBoard) > 0; | 138 | return baseMapper.updateById(dataBoard) > 0; |
139 | }) | 139 | }) |
140 | .orElseThrow( | 140 | .orElseThrow( |
141 | - () -> { | ||
142 | - throw new TkDataValidationException( | ||
143 | - ErrorMessage.NOT_BELONG_CURRENT_TENANT.getMessage()); | ||
144 | - }); | 141 | + () -> new TkDataValidationException( |
142 | + ErrorMessage.NOT_BELONG_CURRENT_TENANT.getMessage())); | ||
145 | } | 143 | } |
146 | 144 | ||
147 | @Override | 145 | @Override |
@@ -73,6 +73,7 @@ public class TkDataViewServiceImpl extends AbstractBaseService<TkDataViewMapper, | @@ -73,6 +73,7 @@ public class TkDataViewServiceImpl extends AbstractBaseService<TkDataViewMapper, | ||
73 | public TkDataViewDTO saveDataView(TkDataViewDTO tkDataViewDTO) { | 73 | public TkDataViewDTO saveDataView(TkDataViewDTO tkDataViewDTO) { |
74 | TkDataViewEntity dataView = tkDataViewDTO.getEntity(TkDataViewEntity.class); | 74 | TkDataViewEntity dataView = tkDataViewDTO.getEntity(TkDataViewEntity.class); |
75 | dataView.setState(0); | 75 | dataView.setState(0); |
76 | + dataView.setViewType(ViewType.PRIVATE_VIEW); | ||
76 | baseMapper.insert(dataView); | 77 | baseMapper.insert(dataView); |
77 | TkDataViewContentDTO contentDTO = new TkDataViewContentDTO(); | 78 | TkDataViewContentDTO contentDTO = new TkDataViewContentDTO(); |
78 | contentDTO.setTenantId(dataView.getTenantId()); | 79 | contentDTO.setTenantId(dataView.getTenantId()); |
@@ -90,6 +91,7 @@ public class TkDataViewServiceImpl extends AbstractBaseService<TkDataViewMapper, | @@ -90,6 +91,7 @@ public class TkDataViewServiceImpl extends AbstractBaseService<TkDataViewMapper, | ||
90 | } | 91 | } |
91 | //设计不修改状态 | 92 | //设计不修改状态 |
92 | tkDataViewDTO.setViewType(null); | 93 | tkDataViewDTO.setViewType(null); |
94 | + tkDataViewDTO.setAccessCredentials(dataView.getAccessCredentials()); | ||
93 | baseMapper.updateById(tkDataViewDTO.getEntity(TkDataViewEntity.class)); | 95 | baseMapper.updateById(tkDataViewDTO.getEntity(TkDataViewEntity.class)); |
94 | return tkDataViewDTO; | 96 | return tkDataViewDTO; |
95 | } | 97 | } |