package com.example.sso.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.example.sso.util.RongLianQiMo; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @Slf4j @RestController public class SongHaoYuJieBaoJing { @PostMapping("/yujie") public void yujie(@RequestBody JSONObject datas) throws JsonProcessingException { log.info("yujie " + datas.toJSONString()); JSONObject data = datas.getJSONObject("data"); String taskid = data.getString("taskid"); String phone = data.getString("phone"); String name = data.getString("name"); ObjectMapper mapper = new ObjectMapper(); JSONObject jsonObject = new JSONObject(); jsonObject.put("taskid",taskid); JSONArray vars = new JSONArray(); JSONObject jsonObject1 = new JSONObject(); jsonObject1.put("phone",phone); jsonObject1.put("name",name); String s = mapper.writeValueAsString(jsonObject1); vars.add(s); jsonObject.put("vars",vars); jsonObject.put("count",1); String jsonString = jsonObject.toJSONString(); System.out.println("我是yujie参数 " +jsonString ); String songhao = RongLianQiMo.songhao(jsonString); System.out.println(songhao); } }