package com.jcdm.main.demo.controller; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONPObject; import com.jcdm.main.demo.vo.FeedBackDataVO; import com.jcdm.main.demo.vo.FeedBackVO; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/sendDemo") public class SendDemo { @PostMapping("/push") public JSONObject push(@RequestBody JSONObject param){ FeedBackVO vo = new FeedBackVO(); FeedBackDataVO dataVO = new FeedBackDataVO(); dataVO.setProductNum("1111"); dataVO.setResultCode("S"); dataVO.setResultText("采集完成"); vo.setCode("success"); vo.setMessage("API调用成功"); vo.setData(dataVO); JSONObject from = JSONObject.from(vo); String jsonString = JSONObject.toJSONString(vo); System.out.println(jsonString); return from; } }