Files
stopcar/src/main/java/com/example/sso/controller/ControllerTuiSong.java
2026-01-07 10:58:52 +08:00

187 lines
7.4 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
@RestController
@Slf4j
public class ControllerTuiSong {
@PostMapping("")
public JSONObject createUser(@RequestBody /*@Valid*/ CarInfo carInfo) {
String parkingId = carInfo.getParkingId();
String parkingNume = carInfo.getParkingNume();
String recordId = carInfo.getRecordId();
String plateNumber = carInfo.getPlateNumber();
String entranceTime = carInfo.getEntranceTime();
// String entranceTime = TimeUtils.tim(entranceTime1);
String exitTime = carInfo.getExitTime();
// String exitTime = TimeUtils.tim(exitTime1);
String entranceGateId = carInfo.getEntranceGateId();
String exitGateId = carInfo.getExitGateId();
int releaseType = carInfo.getReleaseType();
String cartypeId = carInfo.getCartypeId();
String carmodelId = carInfo.getCarmodelId();
String inImg = carInfo.getInImg();
String outImg = carInfo.getOutImg();
int enterType = carInfo.getEnterType();
int plateColor = carInfo.getPlateColor();
String isEit1 = carInfo.getIsEit();
String appKey = carInfo.getAppKey();
String remark1 = carInfo.getRemark();
log.info("我是进出推送参数");
log.info("parkingId " + parkingId);
log.info("parkingNume " + parkingNume);
log.info("recordId " + recordId);
log.info("plateNumber " + plateNumber);
log.info("entranceTime " +entranceTime);
log.info("exitTime " + exitTime);
log.info("entranceGateId " + entranceGateId);
log.info("releaseType " + releaseType);
log.info("cartypeId " + cartypeId);
log.info("carmodelId " + carmodelId);
log.info("inImg " + inImg);
log.info("outImg " + outImg);
log.info("enterType " + enterType);
log.info("plateColor " + plateColor);
log.info("isEit " + isEit1);
log.info("appKey " + appKey);
JSONObject object1 = new JSONObject();
object1.put("status", "0");
object1.put("message", "参数不正确,请检擦");
if (!appKey.isEmpty()) {
if (appKey.equals("1900374236010078209")) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("app_id", "67ab0e4982b769eeef25219b");
jsonObject.put("entry_id", "67d0f28cde8bbe9eede569e2");
jsonObject.put("is_start_trigger", true);
JSONObject data = new JSONObject();
JSONObject parkingld = new JSONObject();
parkingld.put("value", parkingId);
data.put("parkingld", parkingld);
JSONObject parkingnume = new JSONObject();
parkingnume.put("value", parkingNume);
data.put("parkingnume", parkingnume);
JSONObject recordld = new JSONObject();
recordld.put("value", recordId);
data.put("recordld", recordld);
JSONObject platenumber = new JSONObject();
platenumber.put("value", plateNumber);
data.put("platenumber", platenumber);
if (entranceTime != null && !entranceTime.isEmpty()) {
JSONObject entrancetime = new JSONObject();
entrancetime.put("value", TimeUtils.tim(entranceTime));
data.put("entrancetime", entrancetime);
}
if ( exitTime != null&& !exitTime.isEmpty()) {
JSONObject exittime = new JSONObject();
exittime.put("value", TimeUtils.tim(exitTime));
data.put("exittime", exittime);
}
JSONObject entrancegateld = new JSONObject();
entrancegateld.put("value", entranceGateId);
data.put("entrancegateld", entrancegateld);
JSONObject exitgateld = new JSONObject();
exitgateld.put("value", exitGateId);
data.put("exitgateld", exitgateld);
JSONObject releasetype = new JSONObject();
releasetype.put("value", releaseType);
data.put("releasetype", releasetype);
JSONObject cartypeld = new JSONObject();
cartypeld.put("value", cartypeId);
data.put("cartypeld", cartypeld);
JSONObject carmodelld = new JSONObject();
carmodelld.put("value", carmodelId);
data.put("carmodelld", carmodelld);
JSONObject inlmg = new JSONObject();
inlmg.put("value", inImg);
data.put("inlmg", inlmg);
JSONObject outlmg = new JSONObject();
outlmg.put("value", outImg);
data.put("outlmg", outlmg);
JSONObject entertype = new JSONObject();
entertype.put("value", enterType);
data.put("entertype", entertype);
JSONObject platecolor = new JSONObject();
platecolor.put("value", plateColor);
data.put("platecolor", platecolor);
JSONObject isEit = new JSONObject();
isEit.put("value", isEit1);
data.put("iseit", isEit);
JSONObject remark = new JSONObject();
remark.put("value", remark1);
data.put("remark", remark);
jsonObject.put("data", data);
String jsonString = jsonObject.toJSONString();
V5utils.add(jsonString);
JSONObject object = new JSONObject();
object.put("status", "1");
object.put("message", "成功");
object.put("parkingId ", parkingId);
object.put("parkingNume ", parkingNume);
object.put("recordId ", recordId);
object.put("plateNumber ", plateNumber);
object.put("entranceTime ", entranceTime);
object.put("exitTime ", exitTime);
object.put("entranceGateId ", entranceGateId);
object.put("releaseType ", releaseType);
object.put("cartypeId ", cartypeId);
object.put("carmodelId ", carmodelId);
object.put("inImg ", inImg);
object.put("outImg ", outImg);
object.put("enterType ", enterType);
object.put("plateColor ", plateColor);
object.put("isEit ", isEit1);
object.put("appKey ", appKey);
return object;
} else {
JSONObject object = new JSONObject();
object.put("status", "0");
object.put("message", "appeky不正确或其他参数为空请检查");
return object;
}
} else {
JSONObject object = new JSONObject();
object.put("status", "0");
object.put("message", "appkey为空请检查");
return object;
}
}
}