feat: 增加ttl 使用实例

This commit is contained in:
wyl
2023-06-25 22:47:00 +08:00
parent 73d5c27005
commit 50487c863a
36 changed files with 1203 additions and 135 deletions
+1
View File
@@ -14,6 +14,7 @@
<module>spring-boot-common</module>
<module>spring-boot-rabbitmq</module>
<module>spring-boot-mybatis</module>
<module>spring-boot-wxrobot</module>
</modules>
<artifactId>spring-boot</artifactId>
+35
View File
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>spring-boot</artifactId>
<groupId>com.wyl.example</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-boot-wxrobot</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,14 @@
package com.wyl.spring.wxrobot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class IBSApplication {
public static void main(String[] args) {
SpringApplication.run(IBSApplication.class, args);
}
}
@@ -0,0 +1,33 @@
package com.wyl.spring.wxrobot.controller;
import com.alibaba.fastjson.JSONObject;
import com.wyl.spring.wxrobot.entity.param.WxRobotMessageParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author: wangyl
* @date: 2023/2/6
* @description:
*/
@RestController
@RequestMapping("/")
@Slf4j
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class RobotMessage {
@PostMapping("/getMessageData")
public String getMessageData(@RequestBody WxRobotMessageParam skuListPageReq) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", 200);
jsonObject.put("message", "成功");
jsonObject.put("data", "123");
System.out.println(jsonObject.toJSONString());
return jsonObject.toJSONString();
}
}
@@ -0,0 +1,22 @@
package com.wyl.spring.wxrobot.entity.param;
import lombok.Data;
/**
* @author: wangyl
* @date: 2023/2/6
* @description: 接收消息参数
*/
@Data
public class WxRobotMessageParam {
/**
* 消息内容
*/
private String text;
ThreadLocal<String> t = new ThreadLocal<>();
public String getText() {
t.set("123");
return text;
}
}
@@ -0,0 +1 @@
server.port=65006