![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
小石头YY
这个作者很懒,什么都没留下…
展开
-
mongodb增加字段
db.gp_message_visitor.update({},{$set:{userLoginAccount:""}},{multi:1})原创 2021-10-05 10:40:58 · 1347 阅读 · 0 评论 -
springboot+ seata+nacos
**1、**在 Seata Release 下载最新版的 Seata Server 并解压得到如下目录:.├──bin├──conf├──file_store└──lib2、 修改 conf/registry.conf 配置,目前seata支持如下的file、nacos 、apollo、zk、consul的注册中心和配置中心。这里我们以nacos 为例。将 type 改为 nacosregistry { # file 、nacos 、eureka、redis、zk、consul、e原创 2021-08-09 12:01:38 · 1241 阅读 · 1 评论 -
Redisson分布式锁简单使用
import org.redisson.Redisson;import org.redisson.api.RLock;import org.redisson.api.RedissonClient;import org.redisson.config.Config;import org.springframework.stereotype.Component;import java.util.concurrent.TimeUnit;@Componentpublic class RedisL.原创 2021-08-03 14:59:50 · 165 阅读 · 0 评论 -
超简单使用redisson延迟队列做定时任务
转载:https://my.oschina.net/wangnian/blog/3167316原创 2021-07-29 21:02:03 · 466 阅读 · 0 评论 -
java TXT文件编码转UTF-8
package com.syqm.greatpan.gateway.controller.multimedia;import java.io.*;import java.net.HttpURLConnection;import java.net.URL;/** * <Detect encoding .> * Copyright (C) <2009> <Fluck,ACC http://androidos.cc/dev> * * This原创 2021-07-29 20:19:19 · 1711 阅读 · 0 评论 -
java常用方法
1.参数检验Preconditions.checkArgument();原创 2021-01-20 14:18:00 · 59 阅读 · 0 评论 -
雪花算法实现优化系统时钟回退
1.工具类/** * 使用雪花算法生成全局id */@Log4j2@Componentpublic class SnowflakeIdUtils { private SnowflakeIdWorker idWorker; @PostConstruct public void init() { Random rd = new Random(); //工作id,数据中心ID long workerId = r原创 2021-01-19 19:33:36 · 799 阅读 · 1 评论 -
mysql创建分区表
1.按天分区CREATE TABLE 表名xxxxxxxxx (id BIGINT ( 20 ) NOT NULL AUTO_INCREMENT COMMENT ‘id’,create_time date NOT NULL COMMENT ‘创建时间’,PRIMARY KEY ( id,create_time)) ENGINE = INNODB AUTO_INCREMENT = 29 DEFAULT CHARSET = utf8mb4 COMMENT = ‘表说明xxxxxxxx’PARTITI原创 2020-11-30 14:12:44 · 808 阅读 · 0 评论 -
表创建时自动创建时间和更新时间
表创建时自动创建时间和更新时间 `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间,即数据首次同步的时间', `update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '触发唯一约束时记录更新时间',...原创 2020-11-25 19:15:49 · 1289 阅读 · 0 评论 -
linux环境下发送post请求 curl
curl --location --request POST '填写url' \--header 'xxxx: xxxxxxxxxxxxx' \--header 'Content-Type: application/json' \--data 'JSON格式'原创 2020-10-16 10:17:42 · 1757 阅读 · 0 评论 -
linux下常用查看日志命令
1.查询日志尾部最后100行的日志,并且随文件tail -fn100 catalina.log2.查询日志文件中的头10行日志head -n100 catalina.log3.清空屏幕ctrl+l 或者 clear4.按照关键字查找日志 (知道程序出问题的模块,而且有日志关键字的可以用此方法)<1>.找到发错错误异常的行号比如我们日志中关键字error表示错误grep "error" -n access.log或者cat -n catalina.log |gre原创 2020-07-02 16:46:59 · 811 阅读 · 1 评论 -
使用lombok后项目启动报警告
在实体类下添加 lombok.config 文件,文件内容为下列内容config.stopBubbling=truelombok.equalsAndHashCode.callSuper=call原创 2020-06-22 14:41:50 · 641 阅读 · 0 评论 -
校验不通过 抛出异常
1.无效状态异常。 一般来说无效状态异常是因为你弄错了调用一个方法的流程if (count < 1) { throw new IllegalStateException("提交失败,数据状态不一致"); }2.不合法的参数异常Preconditions.checkArgument(isValidDate(startTm) && isValidDate(endTm), "日期格式不正确。");...原创 2020-06-04 15:55:44 · 1728 阅读 · 0 评论 -
java BigDecimal.setScale 处理小数
BigDecimal.setScale()方法用于格式化小数点setScale(1)表示保留一位小数,默认用四舍五入方式setScale(1,BigDecimal.ROUND_DOWN)直接删除多余的小数位,如2.35会变成2.3setScale(1,BigDecimal.ROUND_UP)进位处理,2.35变成2.4setScale(1,BigDecimal.ROUND_HALF_UP)...转载 2019-11-13 11:33:58 · 659 阅读 · 0 评论 -
java 将 List中元素互换位置
java 将 List中元素互换位置很多时候我要对List中的元素调换位置,这时候可以用如下代码,意思是将data中的index1与index2元素互换位置//data 为ListCollections.swap(data,index1,index2);...原创 2019-11-13 11:04:12 · 4606 阅读 · 0 评论 -
BeanUtils.copyProperties忽略null值工具类
package com.sf.eos.bpds.core.utils;import com.google.common.collect.Lists;import org.springframework.beans.BeanUtils;import org.springframework.beans.BeanWrapper;import org.springframework.beans....原创 2019-11-04 10:16:00 · 971 阅读 · 0 评论 -
StringUtils中 isNotEmpty 和isNotBlank的区别
//isNotEmpty ://判断某字符串是否非空StringUtils.isNotEmpty(null) = falseStringUtils.isNotEmpty("") = falseStringUtils.isNotEmpty(" ") = trueStringUtils.isNotEmpty("bob") = true//isNotBlank://判断某字符串是否不为空...转载 2019-09-26 18:04:47 · 311 阅读 · 0 评论