
摘抄笔记
Jarvis丶Z
这个作者很懒,什么都没留下…
展开
-
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 · 962 阅读 · 0 评论 -
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 · 1784 阅读 · 0 评论 -
使用@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 · 2189 阅读 · 0 评论 -
记一次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 · 176 阅读 · 0 评论 -
记一次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 · 758 阅读 · 0 评论 -
随手记:@Profile指定配置应用环境
@Profile注解指定配置应用环境为了避免在开发切换环境中频繁修改配置信息,使用@Profile注解灵活指定配置文件应用的部署环境:指定测试环境:指定生产环境:...原创 2020-04-20 09:56:25 · 252 阅读 · 0 评论 -
kafka安装与使用
1.Kafka概述Apache Kafka是一个快速、可扩展的、高吞吐、可容错的分布式发布订阅消息系统,适合在大规模消息处理场景中使用。 Kafka的优势在于:可靠性:Kafka是一个具有分区机制、副本机制和容错机制的分布式消息系统可扩展性:Kafka消息系统支持集群规模的热扩展高性能:Kafka在数据发布和订阅过程中都能保证数据的高吞吐量。即便在TB级数据存储的情况下,仍然能...原创 2018-05-30 16:23:53 · 409 阅读 · 0 评论 -
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 阅读 · 2 评论 -
文件打包并下载(代码)
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 阅读 · 0 评论 -
ES集合非NULL查询
ES关于非空集合查询的构造情景过滤空集合嵌套查询 – 关键词:nested过滤掉parkingOrderFeeRecords集合为空的情况{ "query": { "nested" : { "query" : { "bool" : { "must" : {原创 2017-10-10 14:54:14 · 8864 阅读 · 0 评论 -
记一次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 · 4017 阅读 · 0 评论 -
Spring Cloud-使用feign来消费Restful服务
PS:本文以阿里云验证车牌接口为例,以实现为主feign简介 Feign是一种声明式、模板化的HTTP客户端。在Spring Cloud中使用Feign, 我们可以做到使用HTTP请求远程服务时能与调用本地方法一样的编码体验,开发者完全感知不到这是远程方法,更感知不到这是个HTTP请求,这整个调用过程和Dubbo的RPC非常类似。开发起来非常的优雅。 1. 添加依赖<dependency>原创 2017-08-10 16:49:22 · 1900 阅读 · 0 评论 -
OAuth2 logout
OAuth安全环境中注销用户的访问令牌在AuthorizationServerConfig中创建tokenServices实例 @Configuration@EnableAuthorizationServerpublic class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter { //原创 2017-07-24 20:13:43 · 8610 阅读 · 0 评论