diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 0d18e6f706..95158b2929 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -49,7 +49,7 @@ public interface NumConstant { BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100); BigDecimal ZERO_DECIMAL = new BigDecimal(0); int ONE_THOUSAND = 1000; - int TEN_THOUSAND = 10000; + int THREE_THOUSAND = 3000; int MAX = 99999999; int EIGHTY_EIGHT = 88; int EIGHTY = 80; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java new file mode 100644 index 0000000000..055b7a2ae2 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/StrUtil.java @@ -0,0 +1,29 @@ +package com.epmet.commons.tools.utils; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2022/7/22 9:45 下午 + * @version: 1.0 + */ +public class StrUtil { + + private static final Pattern emoji = Pattern.compile("[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]", Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE); + + public static String filterEmoji(String source) { + + if (source != null) { + Matcher emojiMatcher = emoji.matcher(source); + if (emojiMatcher.find()) { + source = emojiMatcher.replaceAll(""); + return source; + } + return source; + } + return source; + } +} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java index d23eddb40e..c02ed2d50f 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.StrUtil; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.dto.form.patrol.PatrolQueryFormDTO; @@ -229,6 +230,8 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl NumConstant.ONE_THOUSAND) { - eventDescription = eventDescription.substring(NumConstant.ZERO, NumConstant.ONE_THOUSAND); + //如果不为空 长度控制3000以内 + if (StringUtils.isNotBlank(eventDescription) && eventDescription.length() > NumConstant.THREE_THOUSAND) { + eventDescription = eventDescription.substring(NumConstant.ZERO, NumConstant.THREE_THOUSAND); } + eventDescription = StrUtil.filterEmoji(eventDescription); entity.setEventDescription(eventDescription); entity.setWaysOfResolving(item.getWaysOfResolving()); //业务不确定 @@ -163,4 +167,4 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl