浏览代码

工具API名称修改

郑杰 3 年之前
父节点
当前提交
4f82c45d4b

+ 2 - 2
framework/src/main/java/cn/lili/common/utils/StringUtils.java

@@ -177,11 +177,11 @@ public class StringUtils extends StrUtil {
177
     }
177
     }
178
 
178
 
179
     /**
179
     /**
180
-     * 查询字符串中首个数字出现的位置
180
+     * 查询字符串中首个数字或字母出现的位置
181
      * @param str 查询的字符串
181
      * @param str 查询的字符串
182
      * @return 若存在,返回位置索引,否则返回-1;
182
      * @return 若存在,返回位置索引,否则返回-1;
183
      */
183
      */
184
-    public static int findFirstIndexNumberOfStr(String str){
184
+    public static int findFirstIdxAlphabetNumber(String str){
185
         int i = -1;
185
         int i = -1;
186
         Matcher matcher = Pattern.compile("[A-Za-z0-9]").matcher(str);
186
         Matcher matcher = Pattern.compile("[A-Za-z0-9]").matcher(str);
187
         if(matcher.find()) {
187
         if(matcher.find()) {

+ 2 - 2
framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java

@@ -159,14 +159,14 @@ public class OrderItem extends BaseEntity {
159
      * @return 商品名称
159
      * @return 商品名称
160
      */
160
      */
161
     public String getGoodsShortName(){
161
     public String getGoodsShortName(){
162
-        return goodsName.substring(0, StringUtils.findFirstIndexNumberOfStr(goodsName));
162
+        return goodsName.substring(0, StringUtils.findFirstIdxAlphabetNumber(goodsName));
163
     }
163
     }
164
 
164
 
165
     /**
165
     /**
166
      * @return 商品货号
166
      * @return 商品货号
167
      */
167
      */
168
     public String getGoodsCode(){
168
     public String getGoodsCode(){
169
-        int i = StringUtils.findFirstIndexNumberOfStr(goodsName);
169
+        int i = StringUtils.findFirstIdxAlphabetNumber(goodsName);
170
         int endIdx = goodsName.indexOf(" ");
170
         int endIdx = goodsName.indexOf(" ");
171
         return goodsName.substring(i, endIdx == -1 ? goodsName.length() : endIdx);
171
         return goodsName.substring(i, endIdx == -1 ? goodsName.length() : endIdx);
172
     }
172
     }