parent
60ee08880c
commit
b198ad115c
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="beacon_cloud@localhost" uuid="702b1f07-0ea8-4a1f-b42e-119c036b73d5">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306/beacon_cloud</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,12 @@
|
||||
package com.mashibing.api.client;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-19 23:56
|
||||
*/
|
||||
@FeignClient(value="beacon-cache")
|
||||
public class BeaconCacheClient {
|
||||
|
||||
}
|
Binary file not shown.
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.mashibing</groupId>
|
||||
<artifactId>beacon-cloud</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>beacon-cache</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- web项目-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- nacos注册中心-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!-- nacos的配置中心-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!-- data系列的redis依赖-->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.msb.cloud</groupId>
|
||||
<artifactId>horse-framework-starter-redis</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,19 @@
|
||||
package com.mashibing.cache;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-19 20:00
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class CacheStarterApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CacheStarterApp.class,args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.mashibing.cache.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 设置RedisTemplate的序列化方式
|
||||
* @author zjw
|
||||
* @description
|
||||
*/
|
||||
/*
|
||||
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
|
||||
@Bean
|
||||
public <T> RedisTemplate<String,T> redisTemplate(RedisConnectionFactory factory,RedisSerializer<Object> redisSerializer){
|
||||
//1. 构建RedisTemplate对象
|
||||
RedisTemplate<String,T> redisTemplate = new RedisTemplate<>();
|
||||
|
||||
//2. 设置RedisConnectionFactory到RedisTemplate
|
||||
redisTemplate.setConnectionFactory(factory);
|
||||
|
||||
//3. 设置Redis的key的序列化方式
|
||||
redisTemplate.setKeySerializer(RedisSerializer.string());
|
||||
redisTemplate.setHashKeySerializer(RedisSerializer.string());
|
||||
|
||||
//4. 设置Redis的value的序列化方式 Date
|
||||
redisTemplate.setValueSerializer(redisSerializer);
|
||||
redisTemplate.setHashValueSerializer(redisSerializer);
|
||||
|
||||
//5. 保证生效
|
||||
redisTemplate.afterPropertiesSet();
|
||||
|
||||
//6. 返回RedisTemplate
|
||||
return redisTemplate;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RedisSerializer<Object> redisSerializer(){
|
||||
//1. 构建Jackson的ObjectMapper
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
//2. 设置JDK8日期格式的支持
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
Module timeModule = new JavaTimeModule()
|
||||
.addDeserializer(LocalDate.class,new LocalDateDeserializer(dateFormatter))
|
||||
.addDeserializer(LocalDateTime.class,new LocalDateTimeDeserializer(dateTimeFormatter))
|
||||
.addSerializer(LocalDate.class,new LocalDateSerializer(dateFormatter))
|
||||
.addSerializer(LocalDateTime.class,new LocalDateTimeSerializer(dateTimeFormatter));
|
||||
objectMapper.registerModule(timeModule);
|
||||
|
||||
//3. 构建Jackson2JsonRedisSerializer
|
||||
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
|
||||
|
||||
//4. 设置好对JDK8日期的支持
|
||||
jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
|
||||
|
||||
//5. 返回设置好的Jackson2JsonRedisSerializer
|
||||
return jackson2JsonRedisSerializer;
|
||||
}
|
||||
|
||||
|
||||
}*/
|
@ -0,0 +1,35 @@
|
||||
package com.mashibing.cache.controller;
|
||||
|
||||
import com.msb.framework.redis.RedisClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-19 19:59
|
||||
*/
|
||||
@RestController
|
||||
public class TestController {
|
||||
|
||||
@Autowired
|
||||
// private RedisTemplate<String,Object> redisTemplate;
|
||||
private RedisClient redisClient;
|
||||
|
||||
// 写测试 hash结构
|
||||
@PostMapping("/test/set/{key}")
|
||||
public String set(@PathVariable String key, @RequestBody Map map){
|
||||
// redisTemplate.opsForHash().putAll(key,map);
|
||||
redisClient.hSet(key,map);
|
||||
return "ok";
|
||||
}
|
||||
// 读测试
|
||||
@GetMapping("/test/get/{key}")
|
||||
public Map get(@PathVariable String key){
|
||||
// Map<Object, Object> result = redisTemplate.opsForHash().entries(key);
|
||||
Map<String, Object> result = redisClient.hGetAll(key);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
# 服务名称
|
||||
spring:
|
||||
application:
|
||||
name: beacon-cache
|
||||
# 多环境
|
||||
profiles:
|
||||
active: dev
|
||||
# nacos注册中心地址
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.43.132:8848
|
||||
# nacos配置中心地址:
|
||||
config:
|
||||
server-addr: 192.168.43.132:8848
|
||||
file-extension: yml
|
||||
# beacon-cache-dev.yml
|
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.mashibing</groupId>
|
||||
<artifactId>beacon-cloud</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>beacon-test</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.49</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,22 @@
|
||||
package com.mashibing.test;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 0:15
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients
|
||||
@MapperScan(basePackages = "com.mashibing.test.mapper")
|
||||
public class TestStarterApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(TestStarterApp.class,args);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.mashibing.test.client;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 0:50
|
||||
*/
|
||||
@FeignClient(value = "beacon-cache")
|
||||
public interface CacheClient {
|
||||
|
||||
@PostMapping(value = "/cache/hmset/{key}")
|
||||
void hmset(@PathVariable(value = "key")String key, @RequestBody Map<String,Object> map);
|
||||
|
||||
@PostMapping(value = "/cache/set/{key}")
|
||||
void set(@PathVariable(value = "key")String key, @RequestParam(value = "value")Object value);
|
||||
|
||||
@PostMapping(value = "/cache/sadd/{key}")
|
||||
void sadd(@PathVariable(value = "key")String key, @RequestBody Map<String,Object>... maps);
|
||||
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package com.mashibing.test.entity;
|
||||
|
||||
|
||||
public class ClientBalance {
|
||||
|
||||
private long id;
|
||||
private long clientId;
|
||||
private long balance;
|
||||
private java.sql.Timestamp created;
|
||||
private long createId;
|
||||
private java.sql.Timestamp updated;
|
||||
private long updateId;
|
||||
private long isDelete;
|
||||
private String extend1;
|
||||
private String extend2;
|
||||
private String extend3;
|
||||
private String extend4;
|
||||
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public long getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(long clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
|
||||
public long getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(long balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
|
||||
public java.sql.Timestamp getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(java.sql.Timestamp created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
|
||||
public long getCreateId() {
|
||||
return createId;
|
||||
}
|
||||
|
||||
public void setCreateId(long createId) {
|
||||
this.createId = createId;
|
||||
}
|
||||
|
||||
|
||||
public java.sql.Timestamp getUpdated() {
|
||||
return updated;
|
||||
}
|
||||
|
||||
public void setUpdated(java.sql.Timestamp updated) {
|
||||
this.updated = updated;
|
||||
}
|
||||
|
||||
|
||||
public long getUpdateId() {
|
||||
return updateId;
|
||||
}
|
||||
|
||||
public void setUpdateId(long updateId) {
|
||||
this.updateId = updateId;
|
||||
}
|
||||
|
||||
|
||||
public long getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(long isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend1() {
|
||||
return extend1;
|
||||
}
|
||||
|
||||
public void setExtend1(String extend1) {
|
||||
this.extend1 = extend1;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend2() {
|
||||
return extend2;
|
||||
}
|
||||
|
||||
public void setExtend2(String extend2) {
|
||||
this.extend2 = extend2;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend3() {
|
||||
return extend3;
|
||||
}
|
||||
|
||||
public void setExtend3(String extend3) {
|
||||
this.extend3 = extend3;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend4() {
|
||||
return extend4;
|
||||
}
|
||||
|
||||
public void setExtend4(String extend4) {
|
||||
this.extend4 = extend4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClientBalance{" +
|
||||
"id=" + id +
|
||||
", clientId=" + clientId +
|
||||
", balance=" + balance +
|
||||
", created=" + created +
|
||||
", createId=" + createId +
|
||||
", updated=" + updated +
|
||||
", updateId=" + updateId +
|
||||
", isDelete=" + isDelete +
|
||||
", extend1='" + extend1 + '\'' +
|
||||
", extend2='" + extend2 + '\'' +
|
||||
", extend3='" + extend3 + '\'' +
|
||||
", extend4='" + extend4 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,210 @@
|
||||
package com.mashibing.test.entity;
|
||||
|
||||
|
||||
public class ClientBusiness {
|
||||
|
||||
private long id;
|
||||
private String corpname;
|
||||
private String apikey;
|
||||
private String ipAddress;
|
||||
private long isCallback;
|
||||
private String callbackUrl;
|
||||
private String clientLinkname;
|
||||
private String clientPhone;
|
||||
private String clientFilters;
|
||||
private java.sql.Timestamp created;
|
||||
private long createId;
|
||||
private java.sql.Timestamp updated;
|
||||
private long updateId;
|
||||
private long isDelete;
|
||||
private String extend1;
|
||||
private String extend2;
|
||||
private String extend3;
|
||||
private String extend4;
|
||||
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getCorpname() {
|
||||
return corpname;
|
||||
}
|
||||
|
||||
public void setCorpname(String corpname) {
|
||||
this.corpname = corpname;
|
||||
}
|
||||
|
||||
|
||||
public String getApikey() {
|
||||
return apikey;
|
||||
}
|
||||
|
||||
public void setApikey(String apikey) {
|
||||
this.apikey = apikey;
|
||||
}
|
||||
|
||||
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
|
||||
public long getIsCallback() {
|
||||
return isCallback;
|
||||
}
|
||||
|
||||
public void setIsCallback(long isCallback) {
|
||||
this.isCallback = isCallback;
|
||||
}
|
||||
|
||||
|
||||
public String getCallbackUrl() {
|
||||
return callbackUrl;
|
||||
}
|
||||
|
||||
public void setCallbackUrl(String callbackUrl) {
|
||||
this.callbackUrl = callbackUrl;
|
||||
}
|
||||
|
||||
|
||||
public String getClientLinkname() {
|
||||
return clientLinkname;
|
||||
}
|
||||
|
||||
public void setClientLinkname(String clientLinkname) {
|
||||
this.clientLinkname = clientLinkname;
|
||||
}
|
||||
|
||||
|
||||
public String getClientPhone() {
|
||||
return clientPhone;
|
||||
}
|
||||
|
||||
public void setClientPhone(String clientPhone) {
|
||||
this.clientPhone = clientPhone;
|
||||
}
|
||||
|
||||
|
||||
public String getClientFilters() {
|
||||
return clientFilters;
|
||||
}
|
||||
|
||||
public void setClientFilters(String clientFilters) {
|
||||
this.clientFilters = clientFilters;
|
||||
}
|
||||
|
||||
|
||||
public java.sql.Timestamp getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(java.sql.Timestamp created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
|
||||
public long getCreateId() {
|
||||
return createId;
|
||||
}
|
||||
|
||||
public void setCreateId(long createId) {
|
||||
this.createId = createId;
|
||||
}
|
||||
|
||||
|
||||
public java.sql.Timestamp getUpdated() {
|
||||
return updated;
|
||||
}
|
||||
|
||||
public void setUpdated(java.sql.Timestamp updated) {
|
||||
this.updated = updated;
|
||||
}
|
||||
|
||||
|
||||
public long getUpdateId() {
|
||||
return updateId;
|
||||
}
|
||||
|
||||
public void setUpdateId(long updateId) {
|
||||
this.updateId = updateId;
|
||||
}
|
||||
|
||||
|
||||
public long getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(long isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend1() {
|
||||
return extend1;
|
||||
}
|
||||
|
||||
public void setExtend1(String extend1) {
|
||||
this.extend1 = extend1;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend2() {
|
||||
return extend2;
|
||||
}
|
||||
|
||||
public void setExtend2(String extend2) {
|
||||
this.extend2 = extend2;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend3() {
|
||||
return extend3;
|
||||
}
|
||||
|
||||
public void setExtend3(String extend3) {
|
||||
this.extend3 = extend3;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend4() {
|
||||
return extend4;
|
||||
}
|
||||
|
||||
public void setExtend4(String extend4) {
|
||||
this.extend4 = extend4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClientBusiness{" +
|
||||
"id=" + id +
|
||||
", corpname='" + corpname + '\'' +
|
||||
", apikey='" + apikey + '\'' +
|
||||
", ipAddress='" + ipAddress + '\'' +
|
||||
", isCallback=" + isCallback +
|
||||
", callbackUrl='" + callbackUrl + '\'' +
|
||||
", clientLinkname='" + clientLinkname + '\'' +
|
||||
", clientPhone='" + clientPhone + '\'' +
|
||||
", clientFilters='" + clientFilters + '\'' +
|
||||
", created=" + created +
|
||||
", createId=" + createId +
|
||||
", updated=" + updated +
|
||||
", updateId=" + updateId +
|
||||
", isDelete=" + isDelete +
|
||||
", extend1='" + extend1 + '\'' +
|
||||
", extend2='" + extend2 + '\'' +
|
||||
", extend3='" + extend3 + '\'' +
|
||||
", extend4='" + extend4 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,199 @@
|
||||
package com.mashibing.test.entity;
|
||||
|
||||
|
||||
public class ClientSign {
|
||||
|
||||
private long id;
|
||||
private long clientId;
|
||||
private String signInfo;
|
||||
private long signState;
|
||||
private long signType;
|
||||
private String businessWeb;
|
||||
private String proveDescr;
|
||||
private String proveFile;
|
||||
private java.sql.Timestamp created;
|
||||
private long createId;
|
||||
private java.sql.Timestamp updated;
|
||||
private long updateId;
|
||||
private long isDelete;
|
||||
private String extend1;
|
||||
private String extend2;
|
||||
private String extend3;
|
||||
private String extend4;
|
||||
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public long getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(long clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
|
||||
public String getSignInfo() {
|
||||
return signInfo;
|
||||
}
|
||||
|
||||
public void setSignInfo(String signInfo) {
|
||||
this.signInfo = signInfo;
|
||||
}
|
||||
|
||||
|
||||
public long getSignState() {
|
||||
return signState;
|
||||
}
|
||||
|
||||
public void setSignState(long signState) {
|
||||
this.signState = signState;
|
||||
}
|
||||
|
||||
|
||||
public long getSignType() {
|
||||
return signType;
|
||||
}
|
||||
|
||||
public void setSignType(long signType) {
|
||||
this.signType = signType;
|
||||
}
|
||||
|
||||
|
||||
public String getBusinessWeb() {
|
||||
return businessWeb;
|
||||
}
|
||||
|
||||
public void setBusinessWeb(String businessWeb) {
|
||||
this.businessWeb = businessWeb;
|
||||
}
|
||||
|
||||
|
||||
public String getProveDescr() {
|
||||
return proveDescr;
|
||||
}
|
||||
|
||||
public void setProveDescr(String proveDescr) {
|
||||
this.proveDescr = proveDescr;
|
||||
}
|
||||
|
||||
|
||||
public String getProveFile() {
|
||||
return proveFile;
|
||||
}
|
||||
|
||||
public void setProveFile(String proveFile) {
|
||||
this.proveFile = proveFile;
|
||||
}
|
||||
|
||||
|
||||
public java.sql.Timestamp getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(java.sql.Timestamp created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
|
||||
public long getCreateId() {
|
||||
return createId;
|
||||
}
|
||||
|
||||
public void setCreateId(long createId) {
|
||||
this.createId = createId;
|
||||
}
|
||||
|
||||
|
||||
public java.sql.Timestamp getUpdated() {
|
||||
return updated;
|
||||
}
|
||||
|
||||
public void setUpdated(java.sql.Timestamp updated) {
|
||||
this.updated = updated;
|
||||
}
|
||||
|
||||
|
||||
public long getUpdateId() {
|
||||
return updateId;
|
||||
}
|
||||
|
||||
public void setUpdateId(long updateId) {
|
||||
this.updateId = updateId;
|
||||
}
|
||||
|
||||
|
||||
public long getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(long isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend1() {
|
||||
return extend1;
|
||||
}
|
||||
|
||||
public void setExtend1(String extend1) {
|
||||
this.extend1 = extend1;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend2() {
|
||||
return extend2;
|
||||
}
|
||||
|
||||
public void setExtend2(String extend2) {
|
||||
this.extend2 = extend2;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend3() {
|
||||
return extend3;
|
||||
}
|
||||
|
||||
public void setExtend3(String extend3) {
|
||||
this.extend3 = extend3;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend4() {
|
||||
return extend4;
|
||||
}
|
||||
|
||||
public void setExtend4(String extend4) {
|
||||
this.extend4 = extend4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClientSign{" +
|
||||
"id=" + id +
|
||||
", clientId=" + clientId +
|
||||
", signInfo='" + signInfo + '\'' +
|
||||
", signState=" + signState +
|
||||
", signType=" + signType +
|
||||
", businessWeb='" + businessWeb + '\'' +
|
||||
", proveDescr='" + proveDescr + '\'' +
|
||||
", proveFile='" + proveFile + '\'' +
|
||||
", created=" + created +
|
||||
", createId=" + createId +
|
||||
", updated=" + updated +
|
||||
", updateId=" + updateId +
|
||||
", isDelete=" + isDelete +
|
||||
", extend1='" + extend1 + '\'' +
|
||||
", extend2='" + extend2 + '\'' +
|
||||
", extend3='" + extend3 + '\'' +
|
||||
", extend4='" + extend4 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
package com.mashibing.test.entity;
|
||||
|
||||
|
||||
public class ClientTemplate {
|
||||
|
||||
private long id;
|
||||
private long signId;
|
||||
private String templateText;
|
||||
private long templateType;
|
||||
private long templateState;
|
||||
private long useId;
|
||||
private String useWeb;
|
||||
private java.sql.Timestamp created;
|
||||
private long createId;
|
||||
private java.sql.Timestamp updated;
|
||||
private long updateId;
|
||||
private long isDelete;
|
||||
private String extend1;
|
||||
private String extend2;
|
||||
private String extend3;
|
||||
private String extend4;
|
||||
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public long getSignId() {
|
||||
return signId;
|
||||
}
|
||||
|
||||
public void setSignId(long signId) {
|
||||
this.signId = signId;
|
||||
}
|
||||
|
||||
|
||||
public String getTemplateText() {
|
||||
return templateText;
|
||||
}
|
||||
|
||||
public void setTemplateText(String templateText) {
|
||||
this.templateText = templateText;
|
||||
}
|
||||
|
||||
|
||||
public long getTemplateType() {
|
||||
return templateType;
|
||||
}
|
||||
|
||||
public void setTemplateType(long templateType) {
|
||||
this.templateType = templateType;
|
||||
}
|
||||
|
||||
|
||||
public long getTemplateState() {
|
||||
return templateState;
|
||||
}
|
||||
|
||||
public void setTemplateState(long templateState) {
|
||||
this.templateState = templateState;
|
||||
}
|
||||
|
||||
|
||||
public long getUseId() {
|
||||
return useId;
|
||||
}
|
||||
|
||||
public void setUseId(long useId) {
|
||||
this.useId = useId;
|
||||
}
|
||||
|
||||
|
||||
public String getUseWeb() {
|
||||
return useWeb;
|
||||
}
|
||||
|
||||
public void setUseWeb(String useWeb) {
|
||||
this.useWeb = useWeb;
|
||||
}
|
||||
|
||||
|
||||
public java.sql.Timestamp getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(java.sql.Timestamp created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
|
||||
public long getCreateId() {
|
||||
return createId;
|
||||
}
|
||||
|
||||
public void setCreateId(long createId) {
|
||||
this.createId = createId;
|
||||
}
|
||||
|
||||
|
||||
public java.sql.Timestamp getUpdated() {
|
||||
return updated;
|
||||
}
|
||||
|
||||
public void setUpdated(java.sql.Timestamp updated) {
|
||||
this.updated = updated;
|
||||
}
|
||||
|
||||
|
||||
public long getUpdateId() {
|
||||
return updateId;
|
||||
}
|
||||
|
||||
public void setUpdateId(long updateId) {
|
||||
this.updateId = updateId;
|
||||
}
|
||||
|
||||
|
||||
public long getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(long isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend1() {
|
||||
return extend1;
|
||||
}
|
||||
|
||||
public void setExtend1(String extend1) {
|
||||
this.extend1 = extend1;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend2() {
|
||||
return extend2;
|
||||
}
|
||||
|
||||
public void setExtend2(String extend2) {
|
||||
this.extend2 = extend2;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend3() {
|
||||
return extend3;
|
||||
}
|
||||
|
||||
public void setExtend3(String extend3) {
|
||||
this.extend3 = extend3;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend4() {
|
||||
return extend4;
|
||||
}
|
||||
|
||||
public void setExtend4(String extend4) {
|
||||
this.extend4 = extend4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClientTemplate{" +
|
||||
"id=" + id +
|
||||
", signId=" + signId +
|
||||
", templateText='" + templateText + '\'' +
|
||||
", templateType=" + templateType +
|
||||
", templateState=" + templateState +
|
||||
", useId=" + useId +
|
||||
", useWeb='" + useWeb + '\'' +
|
||||
", created=" + created +
|
||||
", createId=" + createId +
|
||||
", updated=" + updated +
|
||||
", updateId=" + updateId +
|
||||
", isDelete=" + isDelete +
|
||||
", extend1='" + extend1 + '\'' +
|
||||
", extend2='" + extend2 + '\'' +
|
||||
", extend3='" + extend3 + '\'' +
|
||||
", extend4='" + extend4 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 1:28
|
||||
*/
|
||||
public interface ClientBalanceMapper {
|
||||
@Select("select balance from client_balance where client_id = #{clientId}")
|
||||
Long findByClientId(@Param("clientId")Long clientId);
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.entity.ClientBusiness;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 0:19
|
||||
*/
|
||||
public interface ClientBusinessMapper {
|
||||
|
||||
@Select("select * from client_business where id = #{id}")
|
||||
ClientBusiness findById(@Param("id") Long id);
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.entity.ClientSign;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 1:06
|
||||
*/
|
||||
public interface ClientSignMapper {
|
||||
@Select("select * from client_sign where client_id = #{clientId}")
|
||||
List<ClientSign> findByClientId(@Param("clientId")Long clientId);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.entity.ClientTemplate;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 1:24
|
||||
*/
|
||||
public interface ClientTemplateMapper {
|
||||
@Select("select * from client_template where sign_id = #{signId}")
|
||||
List<ClientTemplate> findBySignId(@Param("signId") Long signId);
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
# 服务名
|
||||
spring:
|
||||
application:
|
||||
name: beacon-test
|
||||
# nacos地址
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.43.132:8848
|
||||
# datasource
|
||||
datasource:
|
||||
driver-class-name: org.gjt.mm.mysql.Driver
|
||||
url: jdbc:mysql://localhost:3306/beacon_cloud?characterEncoding=utf-8&useSSL=false
|
||||
username: root
|
||||
password: 1234
|
||||
# 端口号
|
||||
server:
|
||||
port: 20000
|
||||
|
||||
# mybatis
|
||||
mybatis:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
@ -0,0 +1,33 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.client.CacheClient;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 1:29
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ClientBalanceMapperTest {
|
||||
|
||||
@Autowired
|
||||
private ClientBalanceMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private CacheClient cacheClient;
|
||||
|
||||
@Test
|
||||
public void findByClientId() {
|
||||
Long balance = mapper.findByClientId(1L);
|
||||
System.out.println(balance);
|
||||
|
||||
cacheClient.set("client_balance:1", balance);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mashibing.test.client.CacheClient;
|
||||
import com.mashibing.test.entity.ClientBusiness;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 0:36
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ClientBusinessMapperTest {
|
||||
|
||||
@Autowired
|
||||
private ClientBusinessMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private CacheClient cacheClient;
|
||||
|
||||
@Test
|
||||
public void findById() throws JsonProcessingException {
|
||||
ClientBusiness cb = mapper.findById(1L);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
Map map = objectMapper.readValue(objectMapper.writeValueAsString(cb), Map.class);
|
||||
cacheClient.hmset("client_business:"+cb.getApikey(),map);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mashibing.test.client.CacheClient;
|
||||
import com.mashibing.test.entity.ClientSign;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 1:08
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ClientSignMapperTest {
|
||||
|
||||
|
||||
@Autowired
|
||||
private CacheClient cacheClient;
|
||||
|
||||
@Autowired
|
||||
private ClientSignMapper mapper;
|
||||
|
||||
@Test
|
||||
public void findByClientId() {
|
||||
List<ClientSign> list = mapper.findByClientId(1L);
|
||||
for (ClientSign clientSign : list) {
|
||||
System.out.println(clientSign);
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map> value = list.stream().map(cs -> {
|
||||
try {
|
||||
return objectMapper.readValue(objectMapper.writeValueAsString(cs), Map.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
cacheClient.sadd("client_sign:1",value.toArray(new Map[]{}));
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mashibing.test.client.CacheClient;
|
||||
import com.mashibing.test.entity.ClientTemplate;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 1:25
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ClientTemplateMapperTest {
|
||||
|
||||
@Autowired
|
||||
private ClientTemplateMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private CacheClient cacheClient;
|
||||
|
||||
@Test
|
||||
public void findBySignId() {
|
||||
List<ClientTemplate> ct1 = mapper.findBySignId(15L);
|
||||
List<ClientTemplate> ct2 = mapper.findBySignId(24L);
|
||||
for (ClientTemplate clientTemplate : ct1) {
|
||||
System.out.println(clientTemplate);
|
||||
}
|
||||
// ct2在现有的库中没有数据
|
||||
System.out.println(ct2);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map> value = ct1.stream().map(ct -> {
|
||||
try {
|
||||
return objectMapper.readValue(objectMapper.writeValueAsString(ct), Map.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
cacheClient.sadd("client_template:15",value.toArray(new Map[]{}));
|
||||
}
|
||||
}
|
Loading…
Reference in new issue