Commit dfd3d058 by hulei

独立automatic

parent 19c55d14
<?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">
<parent>
<artifactId>isc-common-parent</artifactId>
<groupId>com.brilliance.isc</groupId>
<version>3.1.0</version>
<relativePath></relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>isc-common-automatic</artifactId>
<dependencies>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.brilliance.isc</groupId>
<artifactId>isc-common-core</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.brilliance.isc.counter.annotation; package com.brilliance.isc.automatic.annotation;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
......
package com.brilliance.isc.counter.mapper; package com.brilliance.isc.automatic.mapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
......
package com.brilliance.isc.counter.service.impl; package com.brilliance.isc.automatic.service.impl;
import com.brilliance.isc.automatic.annotation.FlowLimit;
import com.brilliance.isc.automatic.mapper.SemphoreMapper;
import com.brilliance.isc.bo.auto.AutoFlow; import com.brilliance.isc.bo.auto.AutoFlow;
import com.brilliance.isc.counter.annotation.FlowLimit;
import com.brilliance.isc.counter.mapper.SemphoreMapper;
import com.brilliance.isc.mda.dao.AutoFlowMapper; import com.brilliance.isc.mda.dao.AutoFlowMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
......
package com.brilliance.isc.counter.exception; package com.brilliance.isc.counter.exception;
import com.brilliance.isc.constant.ErrorCode; import com.brilliance.isc.constant.BizCode;
import com.brilliance.isc.exception.RestBizException; import com.brilliance.isc.exception.RestBizException;
public class CounterException extends RestBizException { public class CounterException extends RestBizException {
public CounterException(String message) { public CounterException(String message) {
super(ErrorCode.COUNTER_ERROR, message); super(BizCode.COUNTER_ERROR, message);
} }
} }
package com.brilliance.isc.common.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import org.springframework.beans.factory.annotation.Autowired;
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.StringRedisSerializer;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.List;
@Configuration
public class RedisTemplateConfig {
@Autowired
private ObjectMapper objectMapper;
@Bean("jacksonRedisTemplate")
public RedisTemplate<String, Object> jacksonRedisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(factory);
// 使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
jacksonSeial.setObjectMapper(objectMapper);
// 值采用json序列化
template.setValueSerializer(jacksonSeial);
//使用StringRedisSerializer来序列化和反序列化redis的key值
template.setKeySerializer(new StringRedisSerializer());
// 设置hash key 和value序列化模式
template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(jacksonSeial);
template.afterPropertiesSet();
return template;
}
}
\ No newline at end of file
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<module>isc-common-service</module> <module>isc-common-service</module>
<module>isc-common-esb</module> <module>isc-common-esb</module>
<module>isc-common-counter</module> <module>isc-common-counter</module>
<module>isc-common-automatic</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment