package com.example.sso.controller; import com.alibaba.fastjson.JSONObject; import com.example.sso.dao.CarInfo; import com.example.sso.util.TimeUtils; import com.example.sso.util.V5utils; 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; @RestController @Slf4j public class ControllerTuiSongs { @PostMapping("/infos") public JSONObject createUser(@RequestBody JSONObject carInfo) { log.info("我是新的infos数据 "+ carInfo.toJSONString() ); String EntryExitDirection = carInfo.getString("EntryExitDirection"); String CarNumber = carInfo.getString("CarNumber"); String ParkingName = carInfo.getString("ParkingName"); String Remarks = carInfo.getString("Remarks"); String EventTime = carInfo.getString("EventTime"); String VehicleType = carInfo.getString("VehicleType"); String LaneName = carInfo.getString("LaneName"); String model = carInfo.getString("model"); String EventName = carInfo.getString("EventName"); JSONObject jsonObject = new JSONObject(); jsonObject.put("app_id", "67ab0e4982b769eeef25219b"); jsonObject.put("entry_id", "694b46ac2b2ce8cf41ad5cb5"); jsonObject.put("is_start_trigger", true); JSONObject data = new JSONObject(); JSONObject parkingld = new JSONObject(); parkingld.put("value", ParkingName); data.put("parkingname", parkingld); JSONObject parkingnume = new JSONObject(); parkingnume.put("value", CarNumber); data.put("carnumber", parkingnume); JSONObject recordld = new JSONObject(); recordld.put("value", LaneName); data.put("lanename", recordld); JSONObject releasetype = new JSONObject(); releasetype.put("value", EventName); data.put("eventname", releasetype); JSONObject cartypeld = new JSONObject(); cartypeld.put("value", EntryExitDirection); data.put("entryexitdirection", cartypeld); JSONObject carmodelld = new JSONObject(); carmodelld.put("value", VehicleType); data.put("vehicletype", carmodelld); JSONObject inlmg = new JSONObject(); inlmg.put("value", model); data.put("modeltype", inlmg); JSONObject outlmg = new JSONObject(); outlmg.put("value", EventTime); data.put("eventtime", outlmg); JSONObject entertype = new JSONObject(); entertype.put("value", Remarks); data.put("remarks", entertype); jsonObject.put("data", data); String jsonString = jsonObject.toJSONString(); V5utils.add(jsonString); JSONObject object = new JSONObject(); object.put("status", "1"); object.put("message", "成功"); return object; } }