Commit 6f031eaa by huzhenkun

修改比较器

parent 41eaece0
...@@ -306,4 +306,6 @@ public class ProductTypeConstant { ...@@ -306,4 +306,6 @@ public class ProductTypeConstant {
* 作品下资源来源于content中心的作品 * 作品下资源来源于content中心的作品
*/ */
public static final String[] RESOURCE_CONTENT_PRODUCT = {AUDIO, VIDEO, BOOK, LISTEN, PDF, ALBUM, FORMAT, EBOOK}; public static final String[] RESOURCE_CONTENT_PRODUCT = {AUDIO, VIDEO, BOOK, LISTEN, PDF, ALBUM, FORMAT, EBOOK};
} }
package com.pcloud.common.utils.string; package com.pcloud.common.utils.string;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.util.Comparator; import java.util.Comparator;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -54,8 +55,8 @@ public class StringComparator implements Comparator<String> { ...@@ -54,8 +55,8 @@ public class StringComparator implements Comparator<String> {
boolean isCh1Num = ch1 >= '0' && ch1 <= '9'; boolean isCh1Num = ch1 >= '0' && ch1 <= '9';
boolean isCh2Num = ch2 >= '0' && ch2 <= '9'; boolean isCh2Num = ch2 >= '0' && ch2 <= '9';
if (isCh1Num && isCh2Num) { if (isCh1Num && isCh2Num) {
long i1 = getNumber(str1.substring(i,i+1)); long i1 = getNumber(str1.substring(i));
long i2 = getNumber(str2.substring(i,i+1)); long i2 = getNumber(str2.substring(i));
if (i1 != i2) { if (i1 != i2) {
return i1 > i2 ? 1 : -1; return i1 > i2 ? 1 : -1;
} }
...@@ -101,9 +102,10 @@ public class StringComparator implements Comparator<String> { ...@@ -101,9 +102,10 @@ public class StringComparator implements Comparator<String> {
break; break;
} }
} }
if (bits > 0) { if (bits > 0 && bits <19) {
num = Long.parseLong(str.substring(0, bits)); num = Long.parseLong(str.substring(0, bits));
} }
return num; return num;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment