hjg
2023-10-14 f6c2f15c37aef4675dda01fb5ec17cde4e141c3f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.mandi.fendan.test;
 
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
 
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
 
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mandi.common.JSONobj;
import com.mandi.common.Jacksonmethod;
import com.mandi.common.SpringContext;
import com.mandi.common.Wxhtmethod;
import com.mandi.dao.common.ObjectResult;
 
 
public class Test1 {
    
    
    @Test
    public void test_rrd(){
        String fhdqNo="120200";
        String str=StringUtils.substring(fhdqNo,0, fhdqNo.length()-2);
        System.err.println(str);
    }
    
    @Test
    public void test_htt(){
        String url="http://10.1.10.101:8089/ws/api/prefix";
        Map<String, Object> params=new HashMap<String, Object>();
        params.put("action", "123");
        List<Map<String, Object>> r=new ArrayList<Map<String,Object>>();
        Map<String, Object> mm=new HashMap<String, Object>();
        mm.put("abc", 1);
        mm.put("bcd", "123");
        r.add(mm);
        params.put("data", mm);
        
        JsonObject jo=Wxhtmethod.postJsonStr(url,"abc");
        System.err.println("jo::::"+jo.toString());
    }
    
    @Test
    public void test_jp(){
 
//        list: ["GFTD-18121682","GFTD-18121693","GFTD-18121695"]
        String list="[\"GFTD-18121682\",\"GFTD-18121693\",\"GFTD-18121695\"]";
        JsonParser jp=new JsonParser();
        JsonArray ja=jp.parse(list).getAsJsonArray();
        for (JsonElement je : ja) {
            String jes=je.getAsString();
            System.err.println("jes::::::::"+jes);
        }
    }
    @Test
    public void test_getjsobj(){
        
//        list: ["GFTD-18121682","GFTD-18121693","GFTD-18121695"]
//        {"code":1,"hint":null,"errmsg":null,"item":"XS201812290003"}
        JsonObject jo=new JsonObject();
        jo.addProperty("code", 0);
        jo.addProperty("item", "XS201812290003");
        for (Entry<String, JsonElement> ey : jo.entrySet()) {
            System.err.println(ey.getKey()+"::::::::"+ey.getValue().getAsString());
        }
        ObjectResult<String> ors=new ObjectResult<String>();
        ors=JSONobj.getobj(jo, ors);
        System.err.println("aaaaaaaaaaa");
//        ors=JSONobj.getobj(jo, ors);
//        System.err.println("a::::::::"+jo);
//        System.err.println("j::::::::"+Jacksonmethod.tojson(ors, false));
    }
    
    
    @Test
    public void test_getccr(){
         
    }
 
}