|
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.parser.Feature;
|
|
|
import com.alibaba.fastjson.serializer.DoubleSerializer;
|
|
|
import com.alibaba.fastjson.serializer.SerializeConfig;
|
|
|
import com.google.gson.Gson;
|
|
|
+import com.winhc.pojo.MergePerson;
|
|
|
import com.winhc.utils.CompanyUtils;
|
|
|
import org.apache.ibatis.javassist.expr.NewArray;
|
|
|
import org.junit.Test;
|
|
@@ -25,16 +26,16 @@ public class TestJson {
|
|
|
List<Map<String, Object>> batch_list = new ArrayList<>();
|
|
|
|
|
|
// for (int i = 0; i <= 10; i++) {
|
|
|
- Integer i = 3;
|
|
|
- HashMap<String, Object> m1 = new HashMap<>();
|
|
|
- m1.put("startId", "startId" + i);
|
|
|
- m1.put("endId", "endId" + i);
|
|
|
- m1.put("startName", "startName" + i);
|
|
|
- m1.put("endName", "endName" + i);
|
|
|
- m1.put("deleted", 1);
|
|
|
- m1.put("percent", i * 0.5);
|
|
|
- m1.put("rid", i * 3);
|
|
|
- batch_list.add(m1);
|
|
|
+ Integer i = 3;
|
|
|
+ HashMap<String, Object> m1 = new HashMap<>();
|
|
|
+ m1.put("startId", "startId" + i);
|
|
|
+ m1.put("endId", "endId" + i);
|
|
|
+ m1.put("startName", "startName" + i);
|
|
|
+ m1.put("endName", "endName" + i);
|
|
|
+ m1.put("deleted", 1);
|
|
|
+ m1.put("percent", i * 0.5);
|
|
|
+ m1.put("rid", i * 3);
|
|
|
+ batch_list.add(m1);
|
|
|
// }
|
|
|
String s = JSON.toJSONString(m1);
|
|
|
JSON.DEFAULT_PARSER_FEATURE &= ~Feature.UseBigDecimal.getMask();
|
|
@@ -55,19 +56,19 @@ public class TestJson {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void test2(){
|
|
|
+ public void test2() {
|
|
|
String r1 = CompanyUtils.getIncrPersonLabel();
|
|
|
System.out.println(r1);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void test3(){
|
|
|
- List<String> list = Arrays.asList("小米","淘宝","京东");
|
|
|
+ public void test3() {
|
|
|
+ List<String> list = Arrays.asList("小米", "淘宝", "京东");
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
sb.append("[");
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
sb.append("'").append(list.get(i)).append("'");
|
|
|
- if(i != list.size() -1){
|
|
|
+ if (i != list.size() - 1) {
|
|
|
sb.append(",");
|
|
|
}
|
|
|
}
|
|
@@ -77,9 +78,19 @@ public class TestJson {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void test4(){
|
|
|
- String id = "07bbf1d166b27b44116e8a5c575e23ed";
|
|
|
+ public void test4() {
|
|
|
+ Collection<MergePerson> values = new ArrayList<>();
|
|
|
+ MergePerson m = new MergePerson("1", "n1", "2", "n2");
|
|
|
+ values.add(m);
|
|
|
+// MergePerson m1 = new MergePerson("1", "n1", "2", "n2");
|
|
|
+// values.add(m1);
|
|
|
+ System.out.println(JSON.toJSONString(values));
|
|
|
|
|
|
+ JSONObject j = new JSONObject();
|
|
|
+ j.put("k1", "1");
|
|
|
+ j.put("k2", "2");
|
|
|
+
|
|
|
+ System.out.println(JSON.toJSONString(Collections.singletonList(j)));
|
|
|
|
|
|
}
|
|
|
}
|