修复替换json字符串参数时,Long\Integer\Double类型数据转换的Bug

pom文件中增加国内阿里Maven私服的链接地址
This commit is contained in:
seagull 2018-11-28 14:11:17 +08:00
parent 9288866d75
commit 8831cd261a
2 changed files with 43 additions and 2 deletions

17
pom.xml
View File

@ -126,7 +126,22 @@
<properties>
<project.build.sourceEncoding>GBK</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>maven-ali</id>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>

View File

@ -1,5 +1,6 @@
package luckyclient.publicclass;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
@ -246,6 +247,31 @@ public class ChangString {
COUNTER++;
}
}
//如果是Long就获取它的值
if(entry.getValue() instanceof Long){
if(key.equals(entry.getKey())){
if(keyindex==COUNTER){
luckyclient.publicclass.LogUtil.APP.info("对象原始Long值"+entry.getValue()+"");
entry.setValue(Long.valueOf(value));
luckyclient.publicclass.LogUtil.APP.info("对象替换后Long值"+entry.getValue()+"");
BCHANG=true;
}
COUNTER++;
}
}
//如果是Double就获取它的值
if(entry.getValue() instanceof BigDecimal){
if(key.equals(entry.getKey())){
if(keyindex==COUNTER){
luckyclient.publicclass.LogUtil.APP.info("对象原始BigDecimal值"+entry.getValue()+"");
BigDecimal bd = new BigDecimal(value);
entry.setValue(bd);
luckyclient.publicclass.LogUtil.APP.info("对象替换后BigDecimal值"+entry.getValue()+"");
BCHANG=true;
}
COUNTER++;
}
}
//如果是Boolean就获取它的值
if(entry.getValue() instanceof Boolean){
if(key.equals(entry.getKey())){
@ -320,7 +346,7 @@ public class ChangString {
}
public static void main(String[] args) {
}
}