- 博客(21)
- 收藏
- 关注
原创 Excel数据读取写入Object
Excel数据读取写入Object使用场景:excel批量写入前数据处理import com.hfcsbc.enterpriseservice.dto.freevehicle.FreeVehicleImportExcel;import lombok.extern.slf4j.Slf4j;import org.apache.poi.ss.usermodel.Cell;import org.apache.poi.ss.usermodel.Row;import org.apache.poi.ss.
2020-08-28 17:15:18
960
原创 Excel数据格式校验
Excel数据格式校验使用场景: excel批量导入前对数据进行校验,不符合条件的返回带标错行的Excel文件import com.hfcsbc.enterpriseservice.dto.ExcelValidationResult;import org.apache.poi.hssf.usermodel.HSSFDateUtil;import org.apache.poi.hssf.usermodel.HSSFWorkbook;import org.apache.poi.ss.usermod
2020-08-28 17:14:46
1781
原创 使用@TypeDefs自定义数据类型
使用@TypeDefs自定义数据类型使用场景:自定义Long数组,使数据库数据类型为bigint[],而不是bytea实现定义公共的ArraySqlTypeDescriptorimport org.hibernate.type.descriptor.ValueBinder;import org.hibernate.type.descriptor.ValueExtractor;import org.hibernate.type.descriptor.WrapperOptions;impo
2020-08-28 17:14:15
2184
原创 记一次redis使用keys
记一次redis使用keys使用场景:项目启动时,索引所有redis缓存删除后重新录入代码分析:redisTemplete.keys("*");优化原因:不能用于生产环境官方文档描述:Warning: consider KEYS as a command that should only be used in production environments with extreme care. It may ruin performance when it is executed again
2020-08-28 17:13:39
174
原创 记一次Spring JPA报错
记一次Spring JPA报错报错信息:ObjectDeletedException:deleted instance passed to merge代码分析:User user = userRepository.findById(id).get();userRepository.delete(user);user.update(message);userRepository.save(user);功能:删除旧数据,创建新数据。原因:在user被delete之后,user实体处于删除状态,
2020-08-28 17:11:37
754
原创 极速搭建简易swagger文档管理框架
极速搭建简易swagger文档管理框架1.pom文件<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <depend...
2020-04-20 10:56:45
150
原创 随手记:@Profile指定配置应用环境
@Profile注解指定配置应用环境为了避免在开发切换环境中频繁修改配置信息,使用@Profile注解灵活指定配置文件应用的部署环境:指定测试环境:指定生产环境:...
2020-04-20 09:56:25
249
原创 kafka安装与使用
1.Kafka概述Apache Kafka是一个快速、可扩展的、高吞吐、可容错的分布式发布订阅消息系统,适合在大规模消息处理场景中使用。 Kafka的优势在于:可靠性:Kafka是一个具有分区机制、副本机制和容错机制的分布式消息系统可扩展性:Kafka消息系统支持集群规模的热扩展高性能:Kafka在数据发布和订阅过程中都能保证数据的高吞吐量。即便在TB级数据存储的情况下,仍然能...
2018-05-30 16:23:53
408
原创 Spring Boot 导出Excel表格
1.导包<dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.11</version></dependency><de
2018-05-23 10:36:32
3925
1
原创 文件打包并下载(代码)
private byte[] downloadImages(HttpServletResponse response, String filePath) { File file = new File(filePath); response.setHeader("Content-Disposition", "attachment;filename=" + fi...
2018-05-23 10:22:18
465
原创 Spring Boot 从Json静态文件中读取数据
Spring Boot 从静态文件中读取数据在实体中,通常使用类似字典表的文件来表示属性,文件大都配置在配置文件中,也可以是静态文件,本次记录如何从静态json文件中读取所需字段。1.文件格式以及路径2.加载文件import org.springframework.beans.factory.annotation.Value;import org.springfram...
2018-05-23 10:00:33
21758
5
原创 Elasticsearch模糊检索处理代码
Elasticsearch模糊检索:数据在ES中的存储以people为例,建立数据模型: 在Elasticsearch中,不存在String类型,String类型以text、keyword类型存储。集合类型数据在ES中是以嵌套对象的方式存储(nested)。 @Document(indexName = "people", type = "people", shards = 1, repl
2018-05-09 11:36:13
4386
原创 ES集合非NULL查询
ES关于非空集合查询的构造情景过滤空集合嵌套查询 – 关键词:nested过滤掉parkingOrderFeeRecords集合为空的情况{ "query": { "nested" : { "query" : { "bool" : { "must" : {
2017-10-10 14:54:14
8863
原创 [Linux]CentOS7校准时间--NTP
CentOS 7校准时间–NTP安装NTP sudo yum -y install ntp使用 ntpdate 测试 NTPntpdate pool.ntp.org查看服务器时间date启动ntpd daemon,持续校准时间systemctl start ntpd查看ntpd daemon是否启动[root@localhost ~]# systemctl status ntpd ntpd.s
2017-09-11 17:30:30
17847
原创 记一次Elasticsearch查询报错
记一次Elasticsearch异常:异常:org.elasticsearch.search.SearchParseException: No mapping found for [id] in order to sort on 出现场景:Elasticsearch库中无数据时,带过滤条件查询。原因查找:It only happens the first time, when you hav
2017-09-05 17:39:52
4006
原创 Spring Cloud-使用feign来消费Restful服务
PS:本文以阿里云验证车牌接口为例,以实现为主feign简介 Feign是一种声明式、模板化的HTTP客户端。在Spring Cloud中使用Feign, 我们可以做到使用HTTP请求远程服务时能与调用本地方法一样的编码体验,开发者完全感知不到这是远程方法,更感知不到这是个HTTP请求,这整个调用过程和Dubbo的RPC非常类似。开发起来非常的优雅。 1. 添加依赖<dependency>
2017-08-10 16:49:22
1900
原创 Spring Cloud学习 -- 配置管理
Spring Cloud Config 简单介绍一下如何使用SpringCloud搭建配置管理。 搭建配置管理会用到Spring Cloud Config,该项目是Spring Cloud的子项目之一。简单介绍一下 Spring Cloud Config:Spring Cloud Config 项目提供服务端和客户端支持 集中式管理分布式环境下的应用配置 基于Spring环境,无缝与S
2017-07-25 15:43:38
523
原创 Spring Cloud学习--服务发现(Eureka)
Spring Cloud – 服务发现(Eureka) 该项目是Spring Cloud的子项目之一,主要内容是对Netflix公司一系列开源产品的包装,它为 Spring Boot 应用提供了自配置的Netflix OSS整合。通过一些简单的注解,开发者就可以快速的在应用中配置一下常用模块并构建庞大的分布式系统。它主要提供的模块包括:服务发现( Eureka ),断路器( Hystrix ),智
2017-07-25 15:42:30
2912
原创 OAuth2 logout
OAuth安全环境中注销用户的访问令牌在AuthorizationServerConfig中创建tokenServices实例 @Configuration@EnableAuthorizationServerpublic class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter { //
2017-07-24 20:13:43
8606
原创 Spring Cloud学习笔记之12-Factor
Spring Cloud学习笔记之12-Factor:Spring Cloud介绍 Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智能路由,微代理,控制总线,一次性令牌,全局锁,领导选举,分布式会话,集群状态)。分布式系统的协调导致锅炉板模式,并且使用Spring Cloud开发人员可以快速站起来实现这些模式的服务和应用程
2017-07-19 12:02:01
700
原创 redis学习日记
1.Redis简介REmote DIctionary Server(Redis) 是一个由Salvatore Sanfilippo写的key-value存储系统。Redis提供了一些丰富的数据结构,包括 lists, sets, ordered sets 以及 hashes ,当然还有和Memcached一样的 strings结构.Redis当然还包括了对这些数据结构的丰富操作。R
2017-06-30 21:00:14
243
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人