From 3618bfe8a0cc0715b23e22a084838d12abf6f636 Mon Sep 17 00:00:00 2001 From: cuibaocheng Date: Mon, 6 Sep 2021 17:50:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E5=AD=97=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E8=87=AA=E5=8A=A8=E8=AE=BE=E7=BD=AE/=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PicturesTemplateServiceImpl.java | 4 ++-- .../impl/PicturesTemplateBuildingServiceImpl.java | 10 ++++++---- .../save-picturestemplatearea.html | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplate/impl/PicturesTemplateServiceImpl.java b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplate/impl/PicturesTemplateServiceImpl.java index 5f52ae9..35d4131 100644 --- a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplate/impl/PicturesTemplateServiceImpl.java +++ b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplate/impl/PicturesTemplateServiceImpl.java @@ -539,9 +539,9 @@ public class PicturesTemplateServiceImpl extends DefaultBaseService implements I */ PicturesTemplateDTO dto = picturesTemplateDao.getPicturesTemplateByCode(picturesTemplateCode); // 因为使用快照的原因, 旧的预览图片不能删除 2021年8月14日19:32:57 - /*if(!StringUtils.isEmpty(dto.getPicturesTemplatePictureUrl())) { + if(!StringUtils.isEmpty(dto.getPicturesTemplatePictureUrl())) { iFileService.delete(dto.getPicturesTemplatePictureUrl()); - }*/ + } String picturesTemplatePictureUrl = iPicturesTemplateBuildingService.saveBase64ToFile(base64); Map map = new HashMap(); map.put("picturesTemplatePicture", base64); diff --git a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplatebuilding/impl/PicturesTemplateBuildingServiceImpl.java b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplatebuilding/impl/PicturesTemplateBuildingServiceImpl.java index 02cac32..ff5199c 100644 --- a/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplatebuilding/impl/PicturesTemplateBuildingServiceImpl.java +++ b/module-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/service/picturestemplatebuilding/impl/PicturesTemplateBuildingServiceImpl.java @@ -203,7 +203,7 @@ public class PicturesTemplateBuildingServiceImpl extends DefaultBaseService impl int y = bean.getY() + fontHeight + 3; // 超出部分, 不显示 int gao = (bean.getY() + bean.getHeight()) - (bean.getFontSize() + 3 ); - if(y > gao) { + if(y > gao && rowList.size() > 1) { break; } graphics.drawString(fontContent, bean.getX(), y); @@ -367,7 +367,7 @@ public class PicturesTemplateBuildingServiceImpl extends DefaultBaseService impl int y = bean.getY() + fontHeight + 3; // 超出部分, 不显示 int gao = (bean.getY() + bean.getHeight()) - (bean.getFontSize() + 3 ); - if(y > gao) { + if(y > gao && rowList.size() > 1) { break; } graphics.drawString(fontContent, bean.getX(), y); @@ -559,8 +559,9 @@ public class PicturesTemplateBuildingServiceImpl extends DefaultBaseService impl } } if(countLength > areaDto.getTemplateAreaFontLength()) { - throw new SaveException(areaDto.getPicturesTemplateTitle() + "超出长度"); + throw new SaveException(areaDto.getTemplateAreaName() + "超出长度"); } + createImageBean.setFontLength(areaDto.getTemplateAreaFontLength()); } createImageBean.setFontBold(Integer.valueOf(areaDto.getTemplateAreaFontBold())); createImageBean.setFontFamily(areaDto.getTemplateAreaFontFamily()); @@ -640,8 +641,9 @@ public class PicturesTemplateBuildingServiceImpl extends DefaultBaseService impl } } if(countLength > areaDto.getTemplateAreaFontLength()) { - throw new SaveException(areaDto.getPicturesTemplateTitle() + "超出长度"); + throw new SaveException(areaDto.getTemplateAreaName() + "超出长度"); } + createImageBean.setFontLength(areaDto.getTemplateAreaFontLength()); } createImageBean.setFontBold(Integer.valueOf(areaDto.getTemplateAreaFontBold())); createImageBean.setFontFamily(areaDto.getTemplateAreaFontFamily()); diff --git a/module-building-pictures/src/main/resources/templates/picturestemplate/save-picturestemplatearea.html b/module-building-pictures/src/main/resources/templates/picturestemplate/save-picturestemplatearea.html index dd15276..2902a08 100644 --- a/module-building-pictures/src/main/resources/templates/picturestemplate/save-picturestemplatearea.html +++ b/module-building-pictures/src/main/resources/templates/picturestemplate/save-picturestemplatearea.html @@ -176,6 +176,9 @@ if(!noChange) { var formData = {templateAreaLeft : x , templateAreaTop : y , templateAreaHeight : h , templateAreaWidth : w }; top.restAjax.put(top.restAjax.path('api/picturestemplatearea/updatepicturestemplateareapoint/{picturesTemplateAreaId}', [id]), formData, null, function(code, data) { + if(data.data) { + top.dialog.msg(data.data, {time: 2000}); + } }, function(code, data) { }, function() { }, function() { @@ -375,6 +378,8 @@ } });*/ + var currentFormData = new Map(); + //修改区域点的x,y,width,height $(document).on('mouseup', '#canvas', function(e){ if(lock == true){ @@ -395,7 +400,15 @@ x = $('#'+id).css("left"); y = $('#'+id).css("top"); console.log("x坐标:"+x.replace("px","")+"y坐标:"+y.replace("px","")+"宽度:"+w+"高度:"+h+"id:"+id); - var formData = {templateAreaLeft : x.replace("px","") , templateAreaTop : y.replace("px","") , templateAreaHeight : h , templateAreaWidth : w }; + var formData = {templateAreaLeft : x.replace("px","") , templateAreaTop : y.replace("px","") , templateAreaHeight : h , templateAreaWidth : w , id : id}; + var oldData = currentFormData.get(id); + if(oldData) { + if (oldData.templateAreaLeft == formData.templateAreaLeft && oldData.templateAreaTop == formData.templateAreaTop && oldData.templateAreaHeight == formData.templateAreaHeight && oldData.templateAreaWidth == formData.templateAreaWidth) { + console.log("位置没有变化, 不进行重复请求"); + return; + } + } + currentFormData.set(id, formData); var loadLayerIndex; top.restAjax.put(top.restAjax.path('api/picturestemplatearea/updatepicturestemplateareapoint/{picturesTemplateAreaId}', [id]), formData, null, function(code, data) { if(data.data) {