ObjectJson 对象创建层次结构体
Postman 结构体
Body:
{
“D”: -1
“Doption”: {
“downd”: “”
},
“paramMap”: {
“CColumns”: [],
“ran”: [],
“select”: [“3”],
“dateSParams”: {
“tyApe”: “DayInterval”,
“dconfig”: {},
“value”: [60000, 1590161]
}
},
“selectName”: “tbstu”
}
创建ObjectJson对象 进行赋值 生产结构体:
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.Arrays;
@Transactional
@Controller
@RequestMapping("/test1")
public class MainBankTest {
@Autowired
private BService service;
@GetMapping(value = "/getTestQuery")
@ResponseBody
public BigDataResp getTestQuery() {
JSONObject objResutl = new JSONObject();
objResutl.put("D" , -1);
JSONObject optionObj = new JSONObject();
optionObj.put("downd" , "");
objResutl.put("option" , optionObj);
JSONObject paramMapObj = new JSONObject();
ArrayList<T> CColumns = new ArrayList<>();
ArrayList<T> ran = new ArrayList<>();
ArrayList<String> select = new ArrayList<>();
select.add(0,"3");
ArrayList value = new ArrayList<>(Arrays.asList(10000L, 159000L ));
JSONObject timeParams = new JSONObject();
JSONObject config = new JSONObject();
timeParams.put( "type", "DayInterval");
timeParams.put( "config", config);
timeParams.put( "value", value);
paramMapObj.put("groupColumns" , groupColumns );
paramMapObj.put("rank" , ran );
paramMapObj.put("select" , select );
paramMapObj.put("timeParams" , timeParams );
objResutl.put("paramMap" , paramMapObj);
objResutl.put("selectName" , "tb_stu");
System.out.println("main queryVO : " + JSON.toJSONString(objResutl));
BigDataResp resp = bankFeignService.getRun(JSON.toJSONString(objResutl)) ;
System.out.println("main resp : " + JSON.toJSONString(resp));
return resp;
}
}