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

This commit is contained in:
cuibaocheng 2021-09-03 15:33:40 +08:00
parent 985927bd26
commit 7cbe59931d
7 changed files with 76 additions and 5 deletions

View File

@ -92,4 +92,6 @@ public interface IPicturesTemplateAreaDao {
void updatePicturesTemplateAreaAll(Map<String, Object> params) throws UpdateException; void updatePicturesTemplateAreaAll(Map<String, Object> params) throws UpdateException;
List<PicturesTemplateAreaBuildingDTO> list(Map<String, Object> queryParams) throws SearchException; List<PicturesTemplateAreaBuildingDTO> list(Map<String, Object> queryParams) throws SearchException;
void updatePicturesTemplateAreaFontLength(Map<String, Object> updateFontLength) throws UpdateException;
} }

View File

@ -26,6 +26,7 @@ import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.UUIDUtil; import ink.wgink.util.UUIDUtil;
import ink.wgink.util.map.HashMapUtil; import ink.wgink.util.map.HashMapUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.omg.CORBA.INTERNAL;
import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
@ -319,6 +320,48 @@ public class PicturesTemplateAreaServiceImpl extends DefaultBaseService implemen
/** /**
* 算出下 * 算出下
*/ */
PicturesTemplateAreaDTO areaDTO = getPicturesTemplateAreaById(picturesTemplateAreaId);
if(areaDTO.getTemplateAreaHeight() != picturesTemplateAreaPiointVO.getTemplateAreaHeight() || areaDTO.getTemplateAreaWidth() != picturesTemplateAreaPiointVO.getTemplateAreaWidth() || areaDTO.getTemplateAreaLeft() != picturesTemplateAreaPiointVO.getTemplateAreaLeft() || areaDTO.getTemplateAreaTop() != picturesTemplateAreaPiointVO.getTemplateAreaTop()) {
// 移动的是文字区域
if("1".equals(areaDTO.getTemplateAreaServerLink())) {
// 计算区域可以容纳的文字数量 . 如果当前的限制字数 > 可容纳字数 , 将可容纳字数存储
Map<String, Object> updateFontLength = getHashMap(2);
updateFontLength.put("picturesTemplateAreaId", picturesTemplateAreaId);
if("1".equals(areaDTO.getTemplateAreaFontCenter())) {
// 居左
int fontLength = (int)(picturesTemplateAreaPiointVO.getTemplateAreaWidth() / Double.valueOf(areaDTO.getTemplateAreaFontSize())) ;
fontLength = fontLength > 1 ? fontLength : 1;
int rowCount = (int)(picturesTemplateAreaPiointVO.getTemplateAreaHeight() / ( Double.valueOf(areaDTO.getTemplateAreaFontSize()) + 3) );
if(rowCount * ( Double.valueOf(areaDTO.getTemplateAreaFontSize()) + 3) > picturesTemplateAreaPiointVO.getTemplateAreaHeight()) {
rowCount = rowCount - 1;
}
rowCount = rowCount > 1 ? rowCount : 1;
// 设置自定义长度限制
if(areaDTO.getTemplateAreaFontLength() > fontLength * rowCount) {
updateFontLength.put("templateAreaFontLength", fontLength * rowCount);
picturesTemplateAreaDao.updatePicturesTemplateAreaFontLength(updateFontLength);
}
}
if("2".equals(areaDTO.getTemplateAreaFontCenter())) {
int fontLength = (int)(picturesTemplateAreaPiointVO.getTemplateAreaWidth() / Double.valueOf(areaDTO.getTemplateAreaFontSize())) ;
// 设置自定义长度限制
if(areaDTO.getTemplateAreaFontLength() > fontLength) {
updateFontLength.put("templateAreaFontLength", fontLength > 1 ? fontLength : 1);
picturesTemplateAreaDao.updatePicturesTemplateAreaFontLength(updateFontLength);
}
}
if("3".equals(areaDTO.getTemplateAreaFontCenter())) {
// 居右
int fontLength = (int)(picturesTemplateAreaPiointVO.getTemplateAreaWidth() / Double.valueOf(areaDTO.getTemplateAreaFontSize())) ;
// 设置自定义长度限制
if(areaDTO.getTemplateAreaFontLength() > fontLength) {
updateFontLength.put("templateAreaFontLength", 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();

View File

@ -199,7 +199,13 @@ public class PicturesTemplateBuildingServiceImpl extends DefaultBaseService impl
/** /**
* 对内容进行封装换行 * 对内容进行封装换行
*/ */
int y = bean.getY() + ( ( ( ( bean.getHeight() / 2) + ( bean.getFontSize() / 2) ) - 3 ) * index ); int fontHeight = bean.getFontSize() * index;
int y = bean.getY() + fontHeight + 3;
// 超出部分, 不显示
int gao = (bean.getY() + bean.getHeight()) - (bean.getFontSize() + 3 );
if(y > gao) {
break;
}
graphics.drawString(fontContent, bean.getX(), y); graphics.drawString(fontContent, bean.getX(), y);
index++; index++;
} }
@ -357,7 +363,13 @@ public class PicturesTemplateBuildingServiceImpl extends DefaultBaseService impl
/** /**
* 对内容进行封装换行 * 对内容进行封装换行
*/ */
int y = bean.getY() + ( ( ( ( bean.getHeight() / 2) + ( bean.getFontSize() / 2) ) - 3 ) * index ); int fontHeight = bean.getFontSize() * index;
int y = bean.getY() + fontHeight + 3;
// 超出部分, 不显示
int gao = (bean.getY() + bean.getHeight()) - (bean.getFontSize() + 3 );
if(y > gao) {
break;
}
graphics.drawString(fontContent, bean.getX(), y); graphics.drawString(fontContent, bean.getX(), y);
index++; index++;
} }

View File

@ -105,6 +105,15 @@
order by t1.gmt_create order by t1.gmt_create
</select> </select>
<update id="updatePicturesTemplateAreaFontLength" parameterType="map">
UPDATE
m_pictures_template_area
SET
template_area_font_length = #{templateAreaFontLength}
WHERE
pictures_template_area_id = #{picturesTemplateAreaId}
</update>
<update id="updatePicturesTemplateAreaAll" parameterType="map"> <update id="updatePicturesTemplateAreaAll" parameterType="map">
UPDATE UPDATE
m_pictures_template_area m_pictures_template_area

View File

@ -465,6 +465,9 @@
m_config_column t1 m_config_column t1
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
<if test="configColumnRole != null and configColumnRole != ''">
AND t1.config_column_role LIKE CONCAT('%', CONCAT( #{configColumnRole} , '%'))
</if>
<if test="configTableId != null and configTableId != ''"> <if test="configTableId != null and configTableId != ''">
AND t1.config_table_id = #{configTableId} AND t1.config_table_id = #{configTableId}
</if> </if>

View File

@ -246,7 +246,7 @@
top.layer.open({ top.layer.open({
type: 2, type: 2,
title: false, title: false,
closeBtn: 0, closeBtn: 1,
area: ['80%', '80%'], area: ['80%', '80%'],
shadeClose: true, shadeClose: true,
anim: 2, anim: 2,

View File

@ -554,9 +554,11 @@ public class ConfigTableOperationServiceImpl extends DefaultBaseService implemen
List<Map<String, Object>> configTableOperationDTOs = list(page.getParams()); List<Map<String, Object>> configTableOperationDTOs = list(page.getParams());
for (Map<String, Object> map : configTableOperationDTOs) { for (Map<String, Object> map : configTableOperationDTOs) {
MiniappUserPO userPO = iMiniappUserService.getPO(map.get("creator").toString()); MiniappUserPO userPO = iMiniappUserService.getPO(map.get("creator").toString());
if(userPO != null) {
map.put("creatorIcon", userPO.getAvatarUrl()); map.put("creatorIcon", userPO.getAvatarUrl());
map.put("creatorNickName", userPO.getNickName()); map.put("creatorNickName", userPO.getNickName());
} }
}
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(configTableOperationDTOs); PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(configTableOperationDTOs);
return new SuccessResultList<>(configTableOperationDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); return new SuccessResultList<>(configTableOperationDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
} }