houweiyu 4 anni fa
commit
d5a8b90a6b
20 ha cambiato i file con 1231 aggiunte e 0 eliminazioni
  1. 56 0
      kankan-daikan-application/src/main/java/kankan/daikan/KankanDaikanApplication.java
  2. 42 0
      kankan-daikan-application/src/main/resources/application-dev.properties
  3. 40 0
      kankan-daikan-application/src/main/resources/application-prod.properties
  4. 41 0
      kankan-daikan-application/src/main/resources/application-test.properties
  5. 35 0
      kankan-daikan-application/src/main/resources/application-uat.properties
  6. 33 0
      kankan-daikan-application/src/main/resources/application.properties
  7. 60 0
      kankan-daikan-application/src/main/resources/log4j2.xml
  8. 14 0
      kankan-daikan-application/src/test/java/CodeAutoGenerator.java
  9. 28 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/config/HystrixConfig.java
  10. 27 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/config/MyBatisPlusLogicalDeleteConfig.java
  11. 22 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/config/MyBatisPlusPageConfig.java
  12. 36 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/config/MyNacosLifecycle.java
  13. 60 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/config/RedisConfiguration.java
  14. 12 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/constant/CommonConstant.java
  15. 35 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/enums/UuidPreEnum.java
  16. 32 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/exception/ControllerHanderException.java
  17. 262 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/utils/DataUtils.java
  18. 73 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/utils/LogoConfig.java
  19. 275 0
      kankan-daikan-core/src/main/java/kankan/daikan/base/utils/QRCodeUtils.java
  20. 48 0
      kankan-daikan-core/src/main/java/kankan/daikan/core/controller/BaseController.java

+ 56 - 0
kankan-daikan-application/src/main/java/kankan/daikan/KankanDaikanApplication.java

@@ -0,0 +1,56 @@
+package kankan.daikan;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * @author abnerhou
+ * @date 2021/1/5 12:25
+ * @desciption
+ */
+@EnableFeignClients
+//@NacosPropertySource(dataId = "abner-test", autoRefreshed = true)
+@EnableDiscoveryClient
+@SpringBootApplication(scanBasePackages = {"fdage.back.sdk.core" , "kankan.daikan" , "fdage.back.sdk.base.swagger"})
+@MapperScan(basePackages = {"kankan.daikan.base.dao"})
+public class KankanDaikanApplication extends SpringBootServletInitializer {
+
+    @Bean
+    public ObjectMapper serializingObjectMapper() {
+        JavaTimeModule module = new JavaTimeModule();
+        LocalDateTimeDeserializer localDateTimeDeserializer =
+                new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        module.addDeserializer(LocalDateTime.class, localDateTimeDeserializer);
+        ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
+                .modules(module)
+                .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
+                .build();
+        return objectMapper;
+
+    }
+
+    @Override
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+        return application.sources(KankanDaikanApplication.class);
+    }
+
+
+    public static void main(String[] args) {
+        SpringApplication springApplication = new SpringApplication(KankanDaikanApplication.class);
+        springApplication.run(args);
+    }
+}

+ 42 - 0
kankan-daikan-application/src/main/resources/application-dev.properties

@@ -0,0 +1,42 @@
+
+server.port=8285
+
+#注册中心
+spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
+
+
+spring.datasource.url=jdbc:mysql://8.135.98.231:3306/fcb-project-manager?serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+spring.datasource.username=root
+spring.datasource.password=4DAGE168!a
+spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
+
+
+swagger.page.title=新版四维带看相关接口
+swagger.page.version=1.0
+swagger.page.desc=涉及到看店、看房业务逻辑的接口
+swagger.page.packagePath=kankan.daikan
+
+#spring.redis.cluster.max-redirects=3
+#spring.redis.cluster.nodes=8.135.107.23:30064
+#redis
+spring.redis.database=0
+spring.redis.host=127.0.0.1
+spring.redis.port=6379
+spring.redis.password=
+spring.redis.timeout=5000ms
+spring.redis.jedis.pool.max-active=8
+spring.redis.jedis.pool.max-idle=8
+spring.redis.jedis.pool.max-wait=-1
+spring.redis.jedis.pool.min-idle=0
+
+
+
+oss.point=http://oss-cn-shenzhen.aliyuncs.com
+oss.key=LTAIUrvuHqj8pvry
+oss.secrey=JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4
+oss.bucket=4d-tjw
+
+share.logo.oss.path=domain/daikan/
+oss.query.url=https://houseoss.4dkankan.com/
+image.local.path=C:\\Users\\4dage\\Desktop\\logo-file\\
+

+ 40 - 0
kankan-daikan-application/src/main/resources/application-prod.properties

@@ -0,0 +1,40 @@
+
+server.port=8285
+
+#nacos 注册中心
+spring.cloud.nacos.discovery.server-addr=10.71.9.205:80
+
+spring.datasource.url=jdbc:mysql://10.71.188.241:3306/project_manager?serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+spring.datasource.username=user_project_manager_rw
+spring.datasource.password=RfeDpu479Nc2nZv4sThM
+spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
+
+
+spring.redis.cluster.max-redirects=3
+spring.redis.cluster.nodes=10.71.188.181:7000,10.71.188.108:7000,10.71.188.113:7000,10.71.188.206:7000,10.71.188.238:7000,10.71.188.148:7000
+spring.redis.timeout=5000ms
+spring.redis.jedis.pool.max-active=8
+spring.redis.jedis.pool.max-idle=8
+spring.redis.jedis.pool.max-wait=-1
+spring.redis.jedis.pool.min-idle=0
+spring.redis.database=0
+spring.redis.password=m8P6JugfYevMBi8bUnlu
+
+
+fcb.client.code=f9DZZHYIqlBIaDHRgvTFbVwb0LBwMUe0
+fcb.client.secret=SSrwHLyXZ2THcmcNdhne7RSNQO6ZhAao
+
+oss.point=oss-cn-shenzhen-internal.aliyuncs.com
+oss.key=LTAI4G132z2c589AN39YTvub
+oss.secrey=TokcDacRasG8hqbl6ynfaiNTZ97XhO
+oss.bucket=fcb-vrkanfang-prd
+oss.query.url=https://vr-oss01.fcb.com.cn/
+
+share.logo.oss.path=domain/fcb/
+image.local.path=/image/
+vr.scene.link=hengda.html?m=
+
+#管理后台内网域名
+inner.vr.scene.host=https://vr-mc01.fcb.com.cn/
+#管理后台外网域名
+outer.vr.scene.host=https://vr-web01.fcb.com.cn/

+ 41 - 0
kankan-daikan-application/src/main/resources/application-test.properties

@@ -0,0 +1,41 @@
+
+server.port=8285
+#server.port=8385
+
+#注册中心
+spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
+
+spring.datasource.url=jdbc:mysql://127.0.0.1:3306/fcb-project-manager?serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+spring.datasource.username=root
+spring.datasource.password=4DAGE168!a
+spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
+
+
+
+swagger.page.title=新版四维带看相关接口
+swagger.page.version=1.0
+swagger.page.desc=涉及到看店、看房业务逻辑的接口
+swagger.page.packagePath=kankan.daikan
+
+
+spring.redis.cluster.max-redirects=3
+spring.redis.cluster.nodes=10.1.152.54:6379
+spring.redis.timeout=5000ms
+spring.redis.jedis.pool.max-active=8
+spring.redis.jedis.pool.max-idle=8
+spring.redis.jedis.pool.max-wait=-1
+spring.redis.jedis.pool.min-idle=0
+spring.redis.database=0
+spring.redis.password=
+
+
+
+oss.point=http://oss-cn-shenzhen.aliyuncs.com
+oss.key=LTAIUrvuHqj8pvry
+oss.secrey=JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4
+oss.bucket=4d-tjw
+
+share.logo.oss.path=domain/daikan/
+oss.query.url=https://houseoss.4dkankan.com/
+
+image.local.path=/image/

+ 35 - 0
kankan-daikan-application/src/main/resources/application-uat.properties

@@ -0,0 +1,35 @@
+
+server.port=8285
+#server.port=8385
+
+#注册中心
+spring.cloud.nacos.discovery.server-addr=10.71.5.163:80
+
+spring.datasource.url=jdbc:mysql://10.71.184.146:3306/db_4dkankan?serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
+spring.datasource.username=user_4dkankan_rw
+spring.datasource.password=y2b9a42wRwGNKkJjCm1o
+spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
+
+
+spring.redis.cluster.max-redirects=3
+spring.redis.cluster.nodes=10.71.184.237:7000,10.71.184.181:7000,10.71.184.217:7000
+spring.redis.timeout=5000ms
+spring.redis.jedis.pool.max-active=8
+spring.redis.jedis.pool.max-idle=8
+spring.redis.jedis.pool.max-wait=-1
+spring.redis.jedis.pool.min-idle=0
+spring.redis.database=0
+spring.redis.password=QBzhHTxfcYLTs0n5J5VQ
+
+
+fcb.client.code=dX96cHOkZm61AiCFni5k4qOlxvj8jSF7
+fcb.client.secret=LIbcds1lp5nYRBWsrQPMLxDxJxSOQxOw
+
+oss.point=oss-cn-shenzhen-internal.aliyuncs.com
+oss.key=LTAI4FyDDFpGGjTJZEQH4yaK
+oss.secrey=mqVRTWbWcn4sNMoWmnRq6eToWr9BIy
+oss.bucket=fcb-vrkanfang-uat
+
+share.logo.oss.path=domain/daikan/
+oss.query.url=https://vr-web02-uat.fcb.com.cn/
+image.local.path=/image/

+ 33 - 0
kankan-daikan-application/src/main/resources/application.properties

@@ -0,0 +1,33 @@
+
+
+#spring.profiles.active=prod
+spring.profiles.active=dev
+#spring.profiles.active=uat
+#sit环境,这里使用了test因为sdk的swagger使用的是test,所以这里使用sit
+#spring.profiles.active=test
+
+#应用名
+spring.application.name=kankan-daikan
+
+
+#nacos.config.server-addr=127.0.0.1:AuditController8848
+
+
+#rocketmq.name-server=8.135.107.23:9876
+#rocketmq.consumer.group=rocketmq-cluster5
+#rocketmq.consumer.topic=abner-test
+
+mybatis-plus.global-config.db-config.logic-delete-value=1
+mybatis-plus.global-config.db-config.logic-not-delete-value=0
+
+# 设置单个文件大小
+spring.servlet.multipart.max-file-size= 50MB
+#设置单次请求文件的总大小
+spring.servlet.multipart.max-request-size= 50MB
+
+#RPC feign开启熔断器,防止雪崩
+feign.hystrix.enabled=true
+
+
+
+

+ 60 - 0
kankan-daikan-application/src/main/resources/log4j2.xml

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<configuration status="INFO">
+    <!--全局参数-->
+    <Properties>
+        <Property name="pattern">%d{yyyy-MM-dd HH:mm:ss,SSS} [%thread]  |-%-5level   %c{1}:%L - %m%n</Property>
+        <property name="LOG_HOME">var/logs/kankan-daikan/</property>
+        <property name="REQUEST_FILE_NAME">request</property>
+        <property name="INFO_FILE_NAME">log_info</property>
+    </Properties>
+    <Appenders>
+        <Console name="Console" target="SYSTEM_OUT">
+            <PatternLayout>
+                <pattern>
+                    ${pattern}
+                </pattern>
+            </PatternLayout>
+        </Console>
+
+        <RollingFile  name="info-log"
+                                 fileName="${LOG_HOME}/${INFO_FILE_NAME}.log"
+                                 filePattern="${LOG_HOME}/$${date:yyyy-MM}/${INFO_FILE_NAME}-%d{yyyy-MM-dd}-%i.log">
+            <PatternLayout>
+                <pattern>
+                    ${pattern}
+                </pattern>
+            </PatternLayout>
+            <Policies>
+                <TimeBasedTriggeringPolicy modulate="true" interval="1"/>
+                <SizeBasedTriggeringPolicy size="200 MB"/>
+            </Policies>
+            <DefaultRolloverStrategy max="200"/>
+        </RollingFile >
+
+        <RollingRandomAccessFile name="request-log"
+                                 fileName="${LOG_HOME}/${REQUEST_FILE_NAME}.log"
+                                 filePattern="${LOG_HOME}/$${date:yyyy-MM}/${REQUEST_FILE_NAME}-%d{yyyy-MM-dd}-%i.log">
+            <PatternLayout
+                    pattern="%date{yyyy-MM-dd HH:mm:ss.SSS} %level [%thread][%file:%line] - %msg%n"/>
+            <Policies>
+                <TimeBasedTriggeringPolicy/>
+                <SizeBasedTriggeringPolicy size="200 MB"/>
+            </Policies>
+            <DefaultRolloverStrategy max="200"/>
+        </RollingRandomAccessFile>
+    </Appenders>
+
+    <Loggers>
+        <Root level="info">
+            <AppenderRef ref="info-log" />
+            <AppenderRef ref="Console" />
+        </Root>
+        <Logger name="request" level="info"
+                additivity="false">
+            <AppenderRef ref="request-log"/>
+        </Logger>
+        <Logger name="org.springframework">
+            <AppenderRef ref="Console" />
+        </Logger>
+    </Loggers>
+</configuration>

+ 14 - 0
kankan-daikan-application/src/test/java/CodeAutoGenerator.java

@@ -0,0 +1,14 @@
+import fdage.back.sdk.base.mybatis.MysqlAutoGenerator;
+
+/**
+ * 2 * @Author: Abner
+ * 3 * @Date: 2021/2/9 10:46
+ * 4
+ */
+public class CodeAutoGenerator {
+
+    public static void main(String[] args) {
+        MysqlAutoGenerator.doAutoGenerator("base" , "kankan.daikan"
+                ,"abner" , "");
+    }
+}

+ 28 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/config/HystrixConfig.java

@@ -0,0 +1,28 @@
+package kankan.daikan.base.config;
+
+import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
+import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect;
+import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class HystrixConfig {
+
+    @Bean
+    @HystrixProperty(name = "circuitBreaker.enabled", value = "true")
+    public HystrixCommandAspect hystrixCommandAspect() {
+        return new HystrixCommandAspect();
+    }
+
+    /**
+     * Send stream message to Hystrix-dashboard
+     */
+    @Bean
+    public ServletRegistrationBean hystrixMetricsStreamServlet() {
+        ServletRegistrationBean registrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
+        registrationBean.addUrlMappings("/hystrix.stream");
+        return registrationBean;
+    }
+}

+ 27 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/config/MyBatisPlusLogicalDeleteConfig.java

@@ -0,0 +1,27 @@
+/*
+
+package fcb.project.manager.base.config;
+
+import com.baomidou.mybatisplus.core.injector.ISqlInjector;
+import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+
+*/
+/**
+ * 2 * @Author: Abner
+ * 3 * @Date: 2021/1/7 14:12
+ * 4
+ *//*
+
+
+@Configuration
+public class MyBatisPlusLogicalDeleteConfig {
+    @Bean
+    public ISqlInjector sqlInjector() {
+        return new LogicSqlInjector();
+    }
+}
+
+*/

+ 22 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/config/MyBatisPlusPageConfig.java

@@ -0,0 +1,22 @@
+package kankan.daikan.base.config;
+
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 2 * @Author: Abner
+ * 3 * @Date: 2021/1/18 9:55
+ * 4
+ */
+@Configuration
+public class MyBatisPlusPageConfig {
+    /**
+     * 分页插件
+     */
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        return new PaginationInterceptor();
+    }
+
+}

+ 36 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/config/MyNacosLifecycle.java

@@ -0,0 +1,36 @@
+package kankan.daikan.base.config;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.alibaba.nacos.registry.NacosAutoServiceRegistration;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+
+/**
+ * 2 * @Author: Abner
+ * 3 * @Date: 2021/1/29 13:59
+ * 4
+ */
+@Configuration
+public class MyNacosLifecycle implements ApplicationContextAware {
+
+    @Autowired(required = false)
+    private NacosAutoServiceRegistration registration;
+
+    @Autowired
+    private Environment environment;
+
+    @Override
+    public void setApplicationContext(ApplicationContext context) throws BeansException {
+        if (registration != null) {
+            String port = environment.getProperty("server.port");
+//            registration.setPort(Integer.parseInt(port));
+            registration.setPort(8285);
+//            registration.register();
+            registration.start();
+        }
+    }
+}
+

+ 60 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/config/RedisConfiguration.java

@@ -0,0 +1,60 @@
+
+package kankan.daikan.base.config;
+
+import com.alibaba.fastjson.support.spring.FastJsonRedisSerializer;
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.cache.annotation.EnableCaching;
+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.core.StringRedisTemplate;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+import java.net.UnknownHostException;
+
+
+/**
+ * 2 * @Author: Abner
+ * 3 * @Date: 2021/1/11 11:44
+ * 4
+ */
+
+
+@Configuration
+@EnableCaching
+public class RedisConfiguration {
+
+    @Bean
+    public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory redisConnectionFactory) throws UnknownHostException {
+        StringRedisTemplate template = new StringRedisTemplate();
+        template.setConnectionFactory(redisConnectionFactory);
+        return template;
+    }
+
+    @Bean
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
+        RedisTemplate<String, Object> template = new RedisTemplate<>();
+        template.setConnectionFactory(factory);
+        FastJsonRedisSerializer fastJsonRedisSerializer =  new FastJsonRedisSerializer(Object.class);
+        template.setValueSerializer(fastJsonRedisSerializer);
+        template.setHashValueSerializer(fastJsonRedisSerializer);
+
+        StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
+
+        // key采用String的序列化方式
+        template.setKeySerializer(stringRedisSerializer);
+        // hash的key也采用String的序列化方式
+        template.setHashKeySerializer(stringRedisSerializer);
+        // value序列化方式采用jackson
+        template.setValueSerializer(fastJsonRedisSerializer);
+        // hash的value序列化方式采用jackson
+        template.setHashValueSerializer(fastJsonRedisSerializer);
+        template.afterPropertiesSet();
+        return template;
+    }
+}
+

+ 12 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/constant/CommonConstant.java

@@ -0,0 +1,12 @@
+package kankan.daikan.base.constant;
+
+/**
+ * 2 * @Author: Abner
+ * 3 * @Date: 2021/1/14 15:48
+ * 4
+ */
+public class CommonConstant {
+
+    public static String REDIS_KEY_SEPERATER = "::";
+
+}

+ 35 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/enums/UuidPreEnum.java

@@ -0,0 +1,35 @@
+package kankan.daikan.base.enums;
+
+/**
+ * 2 * @Author: Abner
+ * 3 * @Date: 2021/1/11 16:18
+ * 4
+ */
+public enum UuidPreEnum {
+
+    AUDIT_ID_PRE("AUD00000" , "项目管理的审核UUID前缀"),
+    ESTATE_ID_PRE("EST00001" , "项目管理的楼盘UUID前缀"),
+    HOUSE_ID_PRE("HUS00001" , "项目管理中房源的UUID前缀"),
+    API_REQUEST_ID_PRE("HOUSREQ0" , "房源格式化请求的UUID前缀"),
+    API_ROOM_ID_PRE("ROOMID01" , "VR看房的SOCKET房间号的UUID前缀"),
+    API_HOUSE_ID_PRE("APIHOUSE" , "API房源信息的UUID前缀"),
+    API_HOUSE_RECOMMEND_ID_PRE("RECHOUSE" , "API房源的推荐房源信息的UUID前缀"),
+    OPERATION_ID_PRE("OP000001" , "操作日志的UUID前缀"),
+    ;
+    private String pre;
+    private String desc;
+
+
+    UuidPreEnum(String pre, String desc) {
+        this.pre = pre;
+        this.desc = desc;
+    }
+
+    public String getPre() {
+        return pre;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+}

+ 32 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/exception/ControllerHanderException.java

@@ -0,0 +1,32 @@
+package kankan.daikan.base.exception;
+
+import fdage.back.sdk.base.entity.Result;
+import fdage.back.sdk.base.exception.CommonBaseException;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+/**
+ * @author abnerhou
+ * @date 2020/9/27 19:09
+ * @desciption
+ */
+@ControllerAdvice
+public class ControllerHanderException {
+
+    @ExceptionHandler(CommonBaseException.class)
+    @ResponseBody
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    //在这个方法里定义我们需要返回的格式
+//    public Map<String, Object> handleUserNotExistException(CommonBaseException ex){
+    public Result handleUserNotExistException(CommonBaseException e){
+       /* Map<String, Object> result = new HashMap<>();
+        result.put("code", ex.getCode());
+        result.put("msg", ex.getMsg());
+        return result;*/
+        return Result.failure(null == e.getCode() ? Result.CODE_FAILURE : e.getCode(), e.getMsg());
+    }
+
+}

+ 262 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/utils/DataUtils.java

@@ -0,0 +1,262 @@
+package kankan.daikan.base.utils;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
+import fdage.back.sdk.utils.FileUtils;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.*;
+
+import static com.google.zxing.client.j2se.MatrixToImageConfig.BLACK;
+import static com.google.zxing.client.j2se.MatrixToImageConfig.WHITE;
+
+/**
+ * @author abnerhou
+ * @date 2020/4/23 17:35
+ * @desciption
+ */
+@Component
+@Log4j2
+public class DataUtils {
+
+    public static BigDecimal getBigDecimalObj(Object data) {
+
+        if (null == data) {
+            return null;
+        } else if (data instanceof String) {
+            String dataStr = (String) data;
+            if (!StringUtils.isEmpty(dataStr.trim())) {
+                return new BigDecimal(dataStr.trim());
+            }
+        } else if (data instanceof Long) {
+            Long dataLong = (Long) data;
+            return BigDecimal.valueOf(dataLong);
+        } else if (data instanceof Integer) {
+            Integer dataInt = (Integer) data;
+            return BigDecimal.valueOf(dataInt);
+
+        } else if (data instanceof Double) {
+            Double dataDouble = (Double) data;
+            return BigDecimal.valueOf(dataDouble);
+        }
+
+        return null;
+
+    }
+
+    public static Integer getInteger(Object object) {
+        if (null == object) {
+            return new Integer(0);
+        }
+        if (object instanceof String) {
+            String ojStr = (String) object;
+            if (StringUtils.isEmpty(ojStr)) {
+                //TODO:在斟酌这里的处理方式
+                return new Integer(0);
+            } else {
+                return new Integer(Integer.parseInt(ojStr.trim()));
+            }
+        } else if (object instanceof Integer) {
+            return (Integer) object;
+        } else if (object instanceof Long) {
+            return (Integer) object;
+        } else if (object instanceof Double) {
+            return (Integer) object;
+        } else {
+            return new Integer(0);
+        }
+    }
+
+    public static Integer getIntegerWithDefault(Object object, boolean withDefault) {
+        if (null == object) {
+
+            return withDefault ? new Integer(0) : null;
+        }
+        if (object instanceof String) {
+            String ojStr = (String) object;
+            if (StringUtils.isEmpty(ojStr)) {
+
+                return withDefault ? new Integer(0) : null;
+            } else {
+                return new Integer(Integer.parseInt(ojStr.trim()));
+            }
+        } else if (object instanceof Integer) {
+            return (Integer) object;
+        } else if (object instanceof Long) {
+            return (Integer) object;
+        } else if (object instanceof Double) {
+            return (Integer) object;
+        } else {
+            return withDefault ? new Integer(0) : null;
+        }
+    }
+
+    public static Map<String, Object> assembleResult(long totalNum, long totalPageNum, long currPageNum, Object list) {
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("totalNum", totalNum);
+        resultMap.put("totalPageNum", totalPageNum);
+        resultMap.put("curPage", currPageNum);
+        resultMap.put("list", list);
+        return resultMap;
+    }
+
+    public static <T> void assembleTimeQueryWrapper(Map<String, Object> constantQuery, String dynamicQuery,
+                                                    QueryWrapper<T> queryWrapper, String idQuery,
+                                                    String secondQuery, String thirdQuery) {
+        assembleConstantQuery(queryWrapper, constantQuery);
+        if (org.apache.commons.lang3.StringUtils.isNotBlank(dynamicQuery)) {
+            queryWrapper.and(wrapper -> wrapper
+                    .or().like(org.apache.commons.lang3.StringUtils.isNotBlank(secondQuery), secondQuery, dynamicQuery)
+                    .or().like(org.apache.commons.lang3.StringUtils.isNotBlank(thirdQuery), thirdQuery, dynamicQuery)
+                    .or().like(dynamicQuery.length() <= 32 && org.apache.commons.lang3.StringUtils.isNotBlank(idQuery), idQuery, dynamicQuery));
+        }
+
+    }
+
+    public static <T> void assembleConstantQuery(QueryWrapper<T> queryWrapper, Map<String, Object> constantQuery) {
+        if (null != queryWrapper && !CollectionUtils.isEmpty(constantQuery)) {
+            for (Map.Entry<String, Object> entry : constantQuery.entrySet()) {
+                queryWrapper.eq(entry.getKey(), entry.getValue());
+            }
+        }
+    }
+
+    /**
+     *  根据map的key进行字典升序排序
+     * @param map
+     * @return map
+     */
+    public static Map<String, Object> sortMapByKey(Map<String, Object>map) {
+        Map<String, Object> treemap = new TreeMap<String, Object>(map);
+        List<Map.Entry<String, Object>> list = new ArrayList<Map.Entry<String, Object>>(treemap.entrySet());
+        Collections.sort(list, new Comparator<Map.Entry<String, Object>>() {
+            @Override
+            public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) {
+                return org.apache.commons.lang3.StringUtils.compare(o1.getKey() , o2.getKey());
+            }
+        });
+        return treemap;
+    }
+
+    /**
+     *
+     * 生成MD5 32位小写字符的密码串
+     * */
+    public static String md5Encryption(String jsonStr) {
+        String re_md5 = new String();
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            md.update(jsonStr.getBytes());
+            byte b[] = md.digest();
+            StringBuffer buf = new StringBuffer("");
+            int i;
+            for (int offset = 0; offset < b.length; offset++) {
+                i = b[offset];
+                if (i < 0){
+                    i += 256;
+                }
+                if (i < 16){
+                    buf.append("0");
+                }
+                buf.append(Integer.toHexString(i));
+            }
+            re_md5 = buf.toString();
+        } catch (NoSuchAlgorithmException e) {
+            log.info("生成MD5密文出错了:{}" , e);
+            e.printStackTrace();
+        }
+        return re_md5.toLowerCase();
+    }
+
+    /**
+    *
+     * 根据上传的照片生成二维码
+    * **/
+    public static boolean createQRCode(String url, String outPath, File logoPathFile) throws Exception {
+        // 生成二维码
+
+        int width = 300; // 二维码图片宽度 300
+        int height = 300; // 二维码图片高度300
+
+        String format = "jpg";// 二维码的图片格式 gif
+
+        Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
+        // 指定纠错等级,纠错级别(L 7%、M 15%、Q 25%、H 30%)
+        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
+        // 内容所使用字符集编码
+        hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
+//      hints.put(EncodeHintType.MAX_SIZE, 350);//设置图片的最大值
+//      hints.put(EncodeHintType.MIN_SIZE, 100);//设置图片的最小值
+        hints.put(EncodeHintType.MARGIN, 1);//设置二维码边的空度,非负数
+
+        BitMatrix bitMatrix = new MultiFormatWriter().encode(url,
+                //编码类型,目前zxing支持:Aztec 2D,CODABAR 1D format,Code 39 1D,Code 93 1D ,Code 128 1D,
+                //Data Matrix 2D , EAN-8 1D,EAN-13 1D,ITF (Interleaved Two of Five) 1D,
+                //MaxiCode 2D barcode,PDF417,QR Code 2D,RSS 14,RSS EXPANDED,UPC-A 1D,UPC-E 1D,UPC/EAN extension,UPC_EAN_EXTENSION
+                BarcodeFormat.QR_CODE,
+                width, //条形码的宽度
+                height, //条形码的高度
+                hints);//生成条形码时的一些配置,此项可选
+
+        //File outputFile = new File("d:" + File.separator + "new-1.gif");//指定输出路径
+        File outputFile = new File(outPath);//指定输出路径
+        FileUtils.deleteFile(outPath);
+        return writeToFile(bitMatrix, format, outputFile, logoPathFile);
+    }
+
+    public static BufferedImage toBufferedImage(BitMatrix matrix) {
+        int width = matrix.getWidth();
+        int height = matrix.getHeight();
+        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+        for (int x = 0; x < width; x++) {
+            for (int y = 0; y < height; y++) {
+                image.setRGB(x, y, (matrix.get(x, y) ? BLACK : WHITE));
+//              image.setRGB(x, y,  (matrix.get(x, y) ? Color.YELLOW.getRGB() : Color.CYAN.getRGB()));
+            }
+        }
+        return image;
+    }
+
+    public static boolean writeToFile(BitMatrix matrix, String format, File file, File logoPathFile) throws IOException {
+        BufferedImage image = toBufferedImage(matrix);
+        //设置logo图标
+        LogoConfig logoConfig = new LogoConfig();
+        image = logoConfig.LogoMatrix(image, logoPathFile);
+
+        if(null == image){
+            return false;
+        }
+        File parFile = new File(file.getParent() + File.separator);
+        if (!parFile.exists()){
+            parFile.mkdirs();
+        }
+
+        if (!ImageIO.write(image, format, file)) {
+            //throw new IOException("Could not write an image of format " + format + " to " + file);
+            log.info("Could not write an image of format " + format + " to " + file);
+            return false;
+        } else {
+            log.info("二维码生成成功!");
+            return true;
+        }
+    }
+
+    public static void main(String[] args) throws Exception{
+        createQRCode("https://www.4dkankan.com/spc.html?m=t-pnj0IJX", "C:/Users/4dage/Desktop/logo-file/t-pnj0IJX1.png", null);
+    }
+
+}

+ 73 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/utils/LogoConfig.java

@@ -0,0 +1,73 @@
+package kankan.daikan.base.utils;
+
+import lombok.extern.log4j.Log4j2;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.geom.RoundRectangle2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+@Log4j2
+public class LogoConfig {
+	/**
+     * 设置 logo  
+     * @param matrixImage 源二维码图片 
+     * @return 返回带有logo的二维码图片 
+     * @throws IOException 
+     * @author Administrator sangwenhao 
+     */  
+     public BufferedImage LogoMatrix(BufferedImage matrixImage, File localFile) throws IOException{
+         /** 
+          * 读取二维码图片,并构建绘图对象 
+          */  
+         Graphics2D g2 = matrixImage.createGraphics();  
+           
+         int matrixWidth = matrixImage.getWidth();  
+         int matrixHeigh = matrixImage.getHeight();
+         /**
+          * 读取Logo图片
+          */
+         if(localFile == null){
+             URL url = this.getClass().getResource("logo.jpg");
+             if(null != url){
+                 localFile = new File(url.getPath());
+             }
+         }
+         if(!localFile.exists()){
+             log.info("{}文件不存在" , localFile.getAbsolutePath());
+             return null;
+         }
+         BufferedImage logo = null;
+         try {
+            logo = ImageIO.read(localFile);
+         }catch (Exception e){
+             log.info("读取二维码源文件出现异常:{}" , e);
+             return null;
+         }
+         if(null == logo){
+             log.info("获取二维码源码照片失败");
+             return null;
+         }
+         //开始绘制图片  
+         g2.drawImage(logo,matrixWidth/5*2,matrixHeigh/5*2, matrixWidth/5, matrixHeigh/5, null);//绘制       
+         BasicStroke stroke = new BasicStroke(5,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);   
+         g2.setStroke(stroke);// 设置笔画对象  
+         //指定弧度的圆角矩形  
+         RoundRectangle2D.Float round = new RoundRectangle2D.Float(matrixWidth/5*2, matrixHeigh/5*2, matrixWidth/5, matrixHeigh/5,20,20);  
+         g2.setColor(Color.white);  
+         g2.draw(round);// 绘制圆弧矩形  
+           
+         //设置logo 有一道灰色边框  
+         BasicStroke stroke2 = new BasicStroke(1,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);   
+         g2.setStroke(stroke2);// 设置笔画对象  
+         RoundRectangle2D.Float round2 = new RoundRectangle2D.Float(matrixWidth/5*2+2, matrixHeigh/5*2+2, matrixWidth/5-4, matrixHeigh/5-4,20,20);  
+         g2.setColor(new Color(128,128,128));  
+         g2.draw(round2);// 绘制圆弧矩形  
+           
+         g2.dispose();  
+         matrixImage.flush() ;  
+         return matrixImage ;  
+     }  
+}

+ 275 - 0
kankan-daikan-core/src/main/java/kankan/daikan/base/utils/QRCodeUtils.java

@@ -0,0 +1,275 @@
+package kankan.daikan.base.utils;
+
+/**
+ * 2 * @Author: Abner
+ * 3 * @Date: 2021/1/27 21:35
+ * 4
+ */
+import java.awt.BasicStroke;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Shape;
+import java.awt.geom.RoundRectangle2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.OutputStream;
+import java.util.Hashtable;
+
+import javax.imageio.ImageIO;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.BinaryBitmap;
+import com.google.zxing.DecodeHintType;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.MultiFormatReader;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.Result;
+import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.common.HybridBinarizer;
+import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
+
+public class QRCodeUtils {
+    private static final String CHARSET = "utf-8";
+    private static final String FORMAT_NAME = "JPG";
+    // 二维码尺寸
+    private static final int QRCODE_SIZE = 300;
+    // LOGO宽度
+    private static final int WIDTH = 60;
+    // LOGO高度
+    private static final int HEIGHT = 60;
+
+    private static BufferedImage createImage(String content, String imgPath,
+                                             boolean needCompress) throws Exception {
+        Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
+        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
+        hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
+        hints.put(EncodeHintType.MARGIN, 1);
+        BitMatrix bitMatrix = new MultiFormatWriter().encode(content,
+                BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints);
+        int width = bitMatrix.getWidth();
+        int height = bitMatrix.getHeight();
+        BufferedImage image = new BufferedImage(width, height,
+                BufferedImage.TYPE_INT_RGB);
+        for (int x = 0; x < width; x++) {
+            for (int y = 0; y < height; y++) {
+                image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000
+                        : 0xFFFFFFFF);
+            }
+        }
+        if (imgPath == null || "".equals(imgPath)) {
+            return image;
+        }
+        // 插入图片
+        QRCodeUtils.insertImage(image, imgPath, needCompress);
+        return image;
+    }
+
+    /**
+     * 插入LOGO
+     *
+     * @param source
+     *            二维码图片
+     * @param imgPath
+     *            LOGO图片地址
+     * @param needCompress
+     *            是否压缩
+     * @throws Exception
+     */
+    private static void insertImage(BufferedImage source, String imgPath,
+                                    boolean needCompress) throws Exception {
+        File file = new File(imgPath);
+        if (!file.exists()) {
+            System.err.println(""+imgPath+"   该文件不存在!");
+            return;
+        }
+        Image src = ImageIO.read(new File(imgPath));
+        int width = src.getWidth(null);
+        int height = src.getHeight(null);
+        if (needCompress) { // 压缩LOGO
+            if (width > WIDTH) {
+                width = WIDTH;
+            }
+            if (height > HEIGHT) {
+                height = HEIGHT;
+            }
+            Image image = src.getScaledInstance(width, height,
+                    Image.SCALE_SMOOTH);
+            BufferedImage tag = new BufferedImage(width, height,
+                    BufferedImage.TYPE_INT_RGB);
+            Graphics g = tag.getGraphics();
+            g.drawImage(image, 0, 0, null); // 绘制缩小后的图
+            g.dispose();
+            src = image;
+        }
+        // 插入LOGO
+        Graphics2D graph = source.createGraphics();
+        int x = (QRCODE_SIZE - width) / 2;
+        int y = (QRCODE_SIZE - height) / 2;
+        graph.drawImage(src, x, y, width, height, null);
+        Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
+        graph.setStroke(new BasicStroke(3f));
+        graph.draw(shape);
+        graph.dispose();
+    }
+
+    /**
+     * 生成二维码(内嵌LOGO)
+     *
+     * @param content
+     *            内容
+     * @param imgPath
+     *            LOGO地址
+     * @param destPath
+     *            存放目录
+     * @param needCompress
+     *            是否压缩LOGO
+     * @throws Exception
+     */
+    public static String encode(String content, String imgPath, String destPath,
+                                boolean needCompress) throws Exception {
+        BufferedImage image = QRCodeUtils.createImage(content, imgPath,
+                needCompress);
+        mkdirs(destPath);
+        String file = System.currentTimeMillis() +".jpg";
+        ImageIO.write(image, FORMAT_NAME, new File(destPath+"/"+file));
+        return file;
+    }
+
+    /**
+     * 当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
+     * @date 2013-12-11 上午10:16:36
+     * @param destPath 存放目录
+     */
+    public static void mkdirs(String destPath) {
+        File file =new File(destPath);
+        //当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
+        if (!file.exists() && !file.isDirectory()) {
+            file.mkdirs();
+        }
+    }
+
+    /**
+     * 生成二维码(内嵌LOGO)
+     *
+     * @param content
+     *            内容
+     * @param imgPath
+     *            LOGO地址
+     * @param destPath
+     *            存储地址
+     * @throws Exception
+     */
+    public static void encode(String content, String imgPath, String destPath)
+            throws Exception {
+        QRCodeUtils.encode(content, imgPath, destPath, false);
+    }
+
+    /**
+     * 生成二维码
+     *
+     * @param content
+     *            内容
+     * @param destPath
+     *            存储地址
+     * @param needCompress
+     *            是否压缩LOGO
+     * @throws Exception
+     */
+    public static void encode(String content, String destPath,
+                              boolean needCompress) throws Exception {
+        QRCodeUtils.encode(content, null, destPath, needCompress);
+    }
+
+    /**
+     * 生成二维码
+     *
+     * @param content
+     *            内容
+     * @param destPath
+     *            存储地址
+     * @throws Exception
+     */
+    public static void encode(String content, String destPath) throws Exception {
+        QRCodeUtils.encode(content, null, destPath, false);
+    }
+
+    /**
+     * 生成二维码(内嵌LOGO)
+     *
+     * @param content
+     *            内容
+     * @param imgPath
+     *            LOGO地址
+     * @param output
+     *            输出流
+     * @param needCompress
+     *            是否压缩LOGO
+     * @throws Exception
+     */
+    public static void encode(String content, String imgPath,
+                              OutputStream output, boolean needCompress) throws Exception {
+        BufferedImage image = QRCodeUtils.createImage(content, imgPath,
+                needCompress);
+        ImageIO.write(image, FORMAT_NAME, output);
+    }
+
+    /**
+     * 生成二维码
+     *
+     * @param content
+     *            内容
+     * @param output
+     *            输出流
+     * @throws Exception
+     */
+    public static void encode(String content, OutputStream output)
+            throws Exception {
+        QRCodeUtils.encode(content, null, output, false);
+    }
+
+    /**
+     * 解析二维码
+     *
+     * @param file
+     *            二维码图片
+     * @return
+     * @throws Exception
+     */
+    public static String decode(File file) throws Exception {
+        BufferedImage image;
+        image = ImageIO.read(file);
+        if (image == null) {
+            return null;
+        }
+        BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(
+                image);
+        BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
+        Result result;
+        Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
+        hints.put(DecodeHintType.CHARACTER_SET, CHARSET);
+        result = new MultiFormatReader().decode(bitmap, hints);
+        String resultStr = result.getText();
+        return resultStr;
+    }
+
+    /**
+     * 解析二维码
+     *
+     * @param path
+     *            二维码图片地址
+     * @return
+     * @throws Exception
+     */
+    public static String decode(String path) throws Exception {
+        return QRCodeUtils.decode(new File(path));
+    }
+
+    public static void main(String[] args) throws Exception {
+        String text = "http://www.baidu.com";  //这里设置自定义网站url
+        String logoPath = "C:\\Users\\4dage\\Desktop\\logo-file\\logo.jpg";
+        String destPath = "C:\\Users\\4dage\\Desktop\\logo-file";
+        System.out.println(QRCodeUtils.encode(text, logoPath, destPath, true));
+    }
+}

+ 48 - 0
kankan-daikan-core/src/main/java/kankan/daikan/core/controller/BaseController.java

@@ -0,0 +1,48 @@
+package kankan.daikan.core.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import fdage.back.sdk.base.enums.ResultCodeEnum;
+import fdage.back.sdk.base.exception.CommonBaseException;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * 2 * @Author: Abner
+ * 3 * @Date: 2021/1/25 10:19
+ * 4
+ */
+public class BaseController {
+
+    public static final String TOKEN = "token";
+
+    @Autowired
+    protected HttpServletRequest request;
+
+    @Autowired
+    protected RedisTemplate redisTemplate;
+
+    protected String getToken(){
+        return request.getHeader(TOKEN);
+    }
+
+    protected ContextTokenBean getContextUserInfo(){
+        String token = request.getHeader(TOKEN);
+        if(StringUtils.isBlank(token)){
+            return null;
+        }
+        JSONObject tokenJsonObj = (JSONObject) redisTemplate.opsForValue().get(token);
+        if(null == tokenJsonObj){
+            throw new CommonBaseException(3004 , "token失效");
+        }
+        ContextTokenBean contextTokenBean = JSON.parseObject(tokenJsonObj.toJSONString() , ContextTokenBean.class);
+        if(null == contextTokenBean){
+            throw new CommonBaseException(ResultCodeEnum.D101 , "解析token失败");
+        }
+        return contextTokenBean;
+    }
+
+}