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 | 10 | private String publicId; |
11 | 11 | |
12 | 12 | @ApiModelProperty(value = "视图类型") |
13 | - private ViewType viewType = ViewType.PRIVATE_VIEW; | |
13 | + private ViewType viewType; | |
14 | 14 | |
15 | 15 | @ApiModelProperty(value = "访问凭证") |
16 | 16 | private String accessCredentials; | ... | ... |
... | ... | @@ -73,6 +73,7 @@ public class TkConfigurationCenterServiceImpl |
73 | 73 | public ConfigurationCenterDTO saveConfiguration(ConfigurationCenterDTO configurationCenterDTO) { |
74 | 74 | TkConfigurationCenterEntity configurationCenter = |
75 | 75 | configurationCenterDTO.getEntity(TkConfigurationCenterEntity.class); |
76 | + configurationCenter.setViewType(ViewType.PRIVATE_VIEW); | |
76 | 77 | baseMapper.insert(configurationCenter); |
77 | 78 | Integer type = FastIotConstants.PC_TYPE; |
78 | 79 | String defaultContent = |
... | ... | @@ -102,6 +103,7 @@ public class TkConfigurationCenterServiceImpl |
102 | 103 | if (!configurationCenter.getTenantId().equals(configurationCenterDTO.getTenantId())) { |
103 | 104 | throw new TkDataValidationException(ErrorMessage.TENANT_MISMATCHING.getMessage()); |
104 | 105 | } |
106 | + configurationCenterDTO.setAccessCredentials(configurationCenter.getAccessCredentials()); | |
105 | 107 | baseMapper.updateById(configurationCenterDTO.getEntity(TkConfigurationCenterEntity.class)); |
106 | 108 | return configurationCenterDTO; |
107 | 109 | } | ... | ... |
... | ... | @@ -43,9 +43,7 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, |
43 | 43 | Optional.ofNullable(queryMap.get("tenantId")) |
44 | 44 | .map(Object::toString) |
45 | 45 | .orElseThrow( |
46 | - () -> { | |
47 | - throw new TkDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | |
48 | - }); | |
46 | + () -> new TkDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage())); | |
49 | 47 | String organizationId = |
50 | 48 | null != queryMap.get("organizationId") ? queryMap.get("organizationId").toString() : null; |
51 | 49 | List<String> organizationIds = null; |
... | ... | @@ -83,10 +81,11 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, |
83 | 81 | @Transactional |
84 | 82 | public DataBoardDTO saveOrUpdateDataBoard(DataBoardDTO dataBoardDTO) { |
85 | 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 | 85 | dataBoard.setAccessCredentials(null); |
88 | 86 | } |
89 | 87 | if (StringUtils.isEmpty(dataBoardDTO.getId())) { |
88 | + dataBoard.setViewType(ViewType.PRIVATE_VIEW); | |
90 | 89 | baseMapper.insert(dataBoard); |
91 | 90 | } else { |
92 | 91 | if (null != dataBoardDTO.getLayout() && !dataBoardDTO.getLayout().isEmpty()) { |
... | ... | @@ -98,11 +97,12 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, |
98 | 97 | .eq(TkDataBoardEntity::getId, dataBoardDTO.getId()) |
99 | 98 | .eq(TkDataBoardEntity::getTenantId, dataBoardDTO.getTenantId())); |
100 | 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 | 104 | .orElseThrow( |
103 | - () -> { | |
104 | - throw new TkDataValidationException(ErrorMessage.INTERNAL_ERROR.getMessage()); | |
105 | - }); | |
105 | + () -> new TkDataValidationException(ErrorMessage.INTERNAL_ERROR.getMessage())); | |
106 | 106 | } |
107 | 107 | return dataBoard.getDTO(DataBoardDTO.class); |
108 | 108 | } |
... | ... | @@ -138,10 +138,8 @@ public class TkDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, |
138 | 138 | return baseMapper.updateById(dataBoard) > 0; |
139 | 139 | }) |
140 | 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 | 145 | @Override | ... | ... |
... | ... | @@ -73,6 +73,7 @@ public class TkDataViewServiceImpl extends AbstractBaseService<TkDataViewMapper, |
73 | 73 | public TkDataViewDTO saveDataView(TkDataViewDTO tkDataViewDTO) { |
74 | 74 | TkDataViewEntity dataView = tkDataViewDTO.getEntity(TkDataViewEntity.class); |
75 | 75 | dataView.setState(0); |
76 | + dataView.setViewType(ViewType.PRIVATE_VIEW); | |
76 | 77 | baseMapper.insert(dataView); |
77 | 78 | TkDataViewContentDTO contentDTO = new TkDataViewContentDTO(); |
78 | 79 | contentDTO.setTenantId(dataView.getTenantId()); |
... | ... | @@ -90,6 +91,7 @@ public class TkDataViewServiceImpl extends AbstractBaseService<TkDataViewMapper, |
90 | 91 | } |
91 | 92 | //设计不修改状态 |
92 | 93 | tkDataViewDTO.setViewType(null); |
94 | + tkDataViewDTO.setAccessCredentials(dataView.getAccessCredentials()); | |
93 | 95 | baseMapper.updateById(tkDataViewDTO.getEntity(TkDataViewEntity.class)); |
94 | 96 | return tkDataViewDTO; |
95 | 97 | } | ... | ... |