Merge pull request #3615 from dataease/pr@dev@fix_app-save

fix(应用): 应用保存增加判断,防止保存为空
This commit is contained in:
xuwei-fit2cloud 2022-11-02 17:34:29 +08:00 committed by GitHub
commit 561168aa21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,12 +81,14 @@ public class PanelAppTemplateService {
if (StringUtils.isEmpty(requestTemplate.getNodeType())) {
requestTemplate.setNodeType("template");
}
if(StringUtils.isNotEmpty(request.getSnapshot())){
//Store static resource into the server
String snapshotName = "app-template-" + request.getId() + ".jpeg";
staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", ""));
requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName);
panelAppTemplateMapper.insertSelective(requestTemplate);
}
}
public void update(PanelAppTemplateRequest request) {
@ -96,9 +98,11 @@ public class PanelAppTemplateService {
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
BeanUtils.copyBean(requestTemplate, request);
//Store static resource into the server
if(StringUtils.isNotEmpty(request.getSnapshot())){
String snapshotName = "app-template-" + request.getId() + ".jpeg";
staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", ""));
requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName);
}
panelAppTemplateMapper.updateByPrimaryKeySelective(requestTemplate);
}