代码说明
This commit is contained in:
5
pom.xml
5
pom.xml
@ -59,6 +59,11 @@
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -0,0 +1,87 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
39
src/main/resources/logback-spring.xml
Normal file
39
src/main/resources/logback-spring.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property name="LOG_PATH" value="./logs" />
|
||||
<property name="LOG_FILE" value="app" />
|
||||
<property name="MAX_HISTORY" value="30" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 按天滚动的文件输出 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 当前日志文件 -->
|
||||
<file>${LOG_PATH}/${LOG_FILE}.log</file>
|
||||
|
||||
<!-- 滚动策略 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 每天0点生成新文件 -->
|
||||
<fileNamePattern>${LOG_PATH}/${LOG_FILE}.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 保留30天 -->
|
||||
<maxHistory>${MAX_HISTORY}</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
|
||||
<!-- 关键:立即刷新,确保启动时有日志就立即创建文件 -->
|
||||
<immediateFlush>true</immediateFlush>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user