增加文字长度自动设置/栏目增加校验

This commit is contained in:
cuibaocheng 2021-09-06 11:13:09 +08:00
parent 06136635a4
commit acecdd5b06
4 changed files with 16 additions and 10 deletions

View File

@ -157,7 +157,7 @@ public interface IPicturesTemplateAreaService {
List<PicturesTemplateAreaDTO> getPicturesTemplateAreaByPicturesTemplateId(String picturesTemplateId) throws SearchException; List<PicturesTemplateAreaDTO> getPicturesTemplateAreaByPicturesTemplateId(String picturesTemplateId) throws SearchException;
SuccessResult updatePicturesTemplateAreaPoint(String picturesTemplateAreaId, PicturesTemplateAreaPiointVO picturesTemplateAreaPiointVO) throws Exception; SuccessResultData<String > updatePicturesTemplateAreaPoint(String picturesTemplateAreaId, PicturesTemplateAreaPiointVO picturesTemplateAreaPiointVO) throws Exception;
SuccessResult copyPicturesTemplateAreaPoint(String picturesTemplateAreaId, String templateAreaSource) throws Exception; SuccessResult copyPicturesTemplateAreaPoint(String picturesTemplateAreaId, String templateAreaSource) throws Exception;

View File

@ -80,7 +80,7 @@ public class PicturesTemplateAreaController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatepicturestemplateareapoint/{picturesTemplateAreaId}") @PutMapping("updatepicturestemplateareapoint/{picturesTemplateAreaId}")
@CheckRequestBodyAnnotation @CheckRequestBodyAnnotation
public SuccessResult updatePicturesTemplateAreaPoint(@PathVariable("picturesTemplateAreaId") String picturesTemplateAreaId, @RequestBody PicturesTemplateAreaPiointVO picturesTemplateAreaPiointVO) throws Exception { public synchronized SuccessResultData<String> updatePicturesTemplateAreaPoint(@PathVariable("picturesTemplateAreaId") String picturesTemplateAreaId, @RequestBody PicturesTemplateAreaPiointVO picturesTemplateAreaPiointVO) throws Exception {
return picturesTemplateAreaService.updatePicturesTemplateAreaPoint(picturesTemplateAreaId, picturesTemplateAreaPiointVO); return picturesTemplateAreaService.updatePicturesTemplateAreaPoint(picturesTemplateAreaId, picturesTemplateAreaPiointVO);
} }

View File

@ -316,12 +316,13 @@ public class PicturesTemplateAreaServiceImpl extends DefaultBaseService implemen
} }
@Override @Override
public SuccessResult updatePicturesTemplateAreaPoint(String picturesTemplateAreaId, PicturesTemplateAreaPiointVO picturesTemplateAreaPiointVO) throws Exception { public SuccessResultData<String> updatePicturesTemplateAreaPoint(String picturesTemplateAreaId, PicturesTemplateAreaPiointVO picturesTemplateAreaPiointVO) throws Exception {
/** /**
* 算出下 * 算出下
*/ */
String message = "";
PicturesTemplateAreaDTO areaDTO = getPicturesTemplateAreaById(picturesTemplateAreaId); PicturesTemplateAreaDTO areaDTO = getPicturesTemplateAreaById(picturesTemplateAreaId);
if(areaDTO.getTemplateAreaHeight() != picturesTemplateAreaPiointVO.getTemplateAreaHeight() || areaDTO.getTemplateAreaWidth() != picturesTemplateAreaPiointVO.getTemplateAreaWidth() || areaDTO.getTemplateAreaLeft() != picturesTemplateAreaPiointVO.getTemplateAreaLeft() || areaDTO.getTemplateAreaTop() != picturesTemplateAreaPiointVO.getTemplateAreaTop()) { //if(areaDTO.getTemplateAreaHeight() != picturesTemplateAreaPiointVO.getTemplateAreaHeight() || areaDTO.getTemplateAreaWidth() != picturesTemplateAreaPiointVO.getTemplateAreaWidth() || areaDTO.getTemplateAreaLeft() != picturesTemplateAreaPiointVO.getTemplateAreaLeft() || areaDTO.getTemplateAreaTop() != picturesTemplateAreaPiointVO.getTemplateAreaTop()) {
// 移动的是文字区域 // 移动的是文字区域
if("1".equals(areaDTO.getTemplateAreaServerLink())) { if("1".equals(areaDTO.getTemplateAreaServerLink())) {
// 计算区域可以容纳的文字数量 . 如果当前的限制字数 > 可容纳字数 , 将可容纳字数存储 // 计算区域可以容纳的文字数量 . 如果当前的限制字数 > 可容纳字数 , 将可容纳字数存储
@ -339,7 +340,8 @@ public class PicturesTemplateAreaServiceImpl extends DefaultBaseService implemen
// 设置自定义长度限制 // 设置自定义长度限制
if(areaDTO.getTemplateAreaFontLength() > fontLength * rowCount) { if(areaDTO.getTemplateAreaFontLength() > fontLength * rowCount) {
updateFontLength.put("templateAreaFontLength", fontLength * rowCount); updateFontLength.put("templateAreaFontLength", fontLength * rowCount);
picturesTemplateAreaDao.updatePicturesTemplateAreaFontLength(updateFontLength); message = "当前区域文字仅可容纳: " + (fontLength * rowCount);
// picturesTemplateAreaDao.updatePicturesTemplateAreaFontLength(updateFontLength);
} }
} }
if("2".equals(areaDTO.getTemplateAreaFontCenter())) { if("2".equals(areaDTO.getTemplateAreaFontCenter())) {
@ -347,7 +349,8 @@ public class PicturesTemplateAreaServiceImpl extends DefaultBaseService implemen
// 设置自定义长度限制 // 设置自定义长度限制
if(areaDTO.getTemplateAreaFontLength() > fontLength) { if(areaDTO.getTemplateAreaFontLength() > fontLength) {
updateFontLength.put("templateAreaFontLength", fontLength > 1 ? fontLength : 1); updateFontLength.put("templateAreaFontLength", fontLength > 1 ? fontLength : 1);
picturesTemplateAreaDao.updatePicturesTemplateAreaFontLength(updateFontLength); message = "当前区域文字仅可容纳: " + (fontLength > 1 ? fontLength : 1);
// picturesTemplateAreaDao.updatePicturesTemplateAreaFontLength(updateFontLength);
} }
} }
if("3".equals(areaDTO.getTemplateAreaFontCenter())) { if("3".equals(areaDTO.getTemplateAreaFontCenter())) {
@ -356,12 +359,12 @@ public class PicturesTemplateAreaServiceImpl extends DefaultBaseService implemen
// 设置自定义长度限制 // 设置自定义长度限制
if(areaDTO.getTemplateAreaFontLength() > fontLength) { if(areaDTO.getTemplateAreaFontLength() > fontLength) {
updateFontLength.put("templateAreaFontLength", fontLength > 1 ? fontLength : 1); updateFontLength.put("templateAreaFontLength", fontLength > 1 ? fontLength : 1);
picturesTemplateAreaDao.updatePicturesTemplateAreaFontLength(updateFontLength); message = "当前区域文字仅可容纳: " + (fontLength > 1 ? fontLength : 1);
// picturesTemplateAreaDao.updatePicturesTemplateAreaFontLength(updateFontLength);
} }
} }
} }
} //}
Double down = picturesTemplateAreaPiointVO.getTemplateAreaLeft() + picturesTemplateAreaPiointVO.getTemplateAreaWidth(); Double down = picturesTemplateAreaPiointVO.getTemplateAreaLeft() + picturesTemplateAreaPiointVO.getTemplateAreaWidth();
picturesTemplateAreaPiointVO.setTemplateAreaDown(down); picturesTemplateAreaPiointVO.setTemplateAreaDown(down);
Double right = picturesTemplateAreaPiointVO.getTemplateAreaTop() + picturesTemplateAreaPiointVO.getTemplateAreaHeight(); Double right = picturesTemplateAreaPiointVO.getTemplateAreaTop() + picturesTemplateAreaPiointVO.getTemplateAreaHeight();
@ -370,7 +373,7 @@ public class PicturesTemplateAreaServiceImpl extends DefaultBaseService implemen
params.put("picturesTemplateAreaId", picturesTemplateAreaId); params.put("picturesTemplateAreaId", picturesTemplateAreaId);
setUpdateInfo(params); setUpdateInfo(params);
picturesTemplateAreaDao.updatePicturesTemplateAreaPoint(params); picturesTemplateAreaDao.updatePicturesTemplateAreaPoint(params);
return new SuccessResult(); return new SuccessResultData<String>(message);
} }
@Override @Override

View File

@ -398,6 +398,9 @@
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 };
var loadLayerIndex; var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/picturestemplatearea/updatepicturestemplateareapoint/{picturesTemplateAreaId}', [id]), formData, null, function(code, data) { 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(code, data) {
top.dialog.msg(data.msg, {time: 1000}); top.dialog.msg(data.msg, {time: 1000});
}, function() { }, function() {