| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | |
|
| | | import cn.hutool.core.util.StrUtil;
|
| | | import cn.hutool.extra.pinyin.PinyinUtil;
|
| | | import org.springframework.util.AntPathMatcher;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.core.text.StrFormatter;
|
| | |
| | | // 用空格补齐
|
| | | return String.format("%-" + length + "s", str);
|
| | | }
|
| | |
|
| | |
|
| | | public static boolean containsChinese(String str) {
|
| | | if (str == null) return false;
|
| | | for (char c : str.toCharArray()) {
|
| | | if (Character.UnicodeScript.of(c) == Character.UnicodeScript.HAN) {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public static String getProcessNo(String processName) {
|
| | | if (StrUtil.isBlank(processName)) {
|
| | | return "";
|
| | | }
|
| | |
|
| | | // 判断是否包含中文
|
| | | if (StringUtils.containsChinese(processName)) {
|
| | | // 中文:拼音首字母
|
| | | return StrUtil.toUpperCase(PinyinUtil.getFirstLetter(processName, ""));
|
| | | } else {
|
| | | // 英文:取大写字母 目前工序名称没有英文的形式 只能处理ExxxBxxx
|
| | | StringBuilder sb = new StringBuilder();
|
| | | for (char c : processName.toCharArray()) {
|
| | | if (Character.isUpperCase(c)) {
|
| | | sb.append(c);
|
| | | }
|
| | | }
|
| | | return sb.toString();
|
| | | }
|
| | | }
|
| | | } |