![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
工具类
开发当中常用好用工具类,方法记录
会跑的葫芦怪
只有阅尽千帆的人,才能像大海一样睿智
展开
-
ExceptionUtil输出异常栈信息
spring boot 全局异常处理器输出异常栈原创 2023-01-06 08:37:54 · 393 阅读 · 0 评论 -
工具类两个坐标点之间的距离
工具类原创 2022-10-28 17:28:23 · 122 阅读 · 0 评论 -
地区树children结构
1.地区树形结构/** * 地区树形结构 * @author xzx * @date 2021/12/21 16:47 */public class DistrictVo { private String code; private String parentCode; private String name; private List<DistrictVo> chridrenList; public String getName() {原创 2022-01-25 10:27:07 · 310 阅读 · 0 评论 -
坐标系转换工具类
/** * 坐标转换工具 * 目前国内主要有以下三种坐标系: * * WGS84:为一种大地坐标系,也是目前广泛使用的GPS全球卫星定位系统使用的坐标系。 * * GCJ02:又称火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标系经加密后的坐标系。 * * BD09:为百度坐标系,在GCJ02坐标系基础上再次加密。其中bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托米制坐标。 * * 非中国地区地图,服务坐标统一使用WGS84坐标。 */publ原创 2022-01-17 14:10:20 · 930 阅读 · 0 评论 -
基于redis生成日期订单编号
public String seqGenerator(String key) { //加上时间戳 如果不需要 String datetime = new SimpleDateFormat("yyyyMMdd").format(new Date()); //查询 key 是否存在, 不存在返回 1 ,存在的话则自增加1 Long autoID = redisTemplate.opsForValue().increment(key + datet.原创 2022-01-04 11:26:36 · 982 阅读 · 0 评论 -
Java中在数字前自动补零方法
/** * Java中在数字前自动补零方法 */public class TestTest { public static void main(String[] args) { //方法一 // 0 代表前面补充0 // 4 代表长度为4 // d 代表参数为正数型 System.out.println(String.format("%04d", 1)); //方法二 System原创 2021-12-14 11:26:07 · 14864 阅读 · 0 评论 -
Java Map 排序
Map<Integer,Integer> map = new HashMap();map.put(3,3);map.put(1,1);map.put(2,1);map.put(4,4);List<Map.entry<Integer,Integer>> list = new ArrayList(map.entrySet());//按value排序list.sort( (o1,o2) -> o2.getValue() - o1.getValue().原创 2021-06-25 10:58:39 · 183 阅读 · 0 评论 -
js 获取当前时间
var timestamp = Date.parse(new Date()); timestamp = timestamp / 1000; //获取当前时间 var n = timestamp * 1000; var date = new Date(n); //年 var Y = date.getFullYear(); //月 var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMont.原创 2021-04-15 11:17:17 · 105 阅读 · 0 评论 -
java AesUtil (五)
/* * Copyright (C), 2017-2018, Night’s Watch * I pledge my life and honor to the Night’s Watch, * for this night and all the nights to come. * FileName: AesUtils.java * Author: join * Date: 2018年11月29日 上午8:13:17 * Description: //模块目的、功能描述 .原创 2020-12-10 11:58:01 · 576 阅读 · 0 评论 -
java MD5Util (四)
package com.xzx.netty.util;import java.io.UnsupportedEncodingException;import java.security.MessageDigest;import java.security.NoSuchAlgorithmException;import java.util.regex.Matcher;import java.util.regex.Pattern;public class MD5Util { /** .原创 2020-12-10 11:56:37 · 240 阅读 · 0 评论 -
java 16进制字符串两个一组存list(三)
/** * 存放16进制字符串,字符串2为 2为存 * @param hexString * @return */ public static List<String> parseArrayList(String hexString){ List<String> strings = new ArrayList<>(); for (int i = 0; i < hexString.len.原创 2020-12-10 11:54:30 · 528 阅读 · 3 评论 -
java 16进制字符串转字节数组(二)
public static byte[] getBytes(String hexString) { if (hexString != null && !hexString.equals("")) { hexString = hexString.toUpperCase(); int length = hexString.length() / 2; char[] hexChars = hexStrin...原创 2020-12-10 11:49:45 · 225 阅读 · 0 评论 -
java 字节数组转16进制字符串(一)
public static String getHexString(byte[] bytes) { StringBuilder stringBuilder = new StringBuilder(""); if (bytes != null && bytes.length > 0) { for(int i = 0; i < bytes.length; ++i) { int v = bytes.原创 2020-12-10 11:45:05 · 232 阅读 · 0 评论 -
半棵树找根
表结构idpidname52节点565节点675节点787节点896节点9108节点10这个表结构 表现了树形菜单的一个根节点下的树形结构,项目需求获取这个树形菜单的根节点public List<Object> getTreeMenuRoot(){ //1.获取菜单所有id List<Long> longs = objectMapper.selectIds(); List<Object&原创 2020-08-20 13:48:17 · 92 阅读 · 0 评论 -
递归根据pid获取最上级
public Object selectParentByPid(Long id){ Object obj = objectMapper.selectObjectById(id); if(obj .getPid() != 0){ obj = selectParentByPid(obj .getPid()); } return obj ;}select * from table where id = #{pid}原创 2020-08-20 11:47:03 · 735 阅读 · 0 评论 -
base64文件上传
配置tupian: uploadPath: d:/file url: http://192.168.8.69:${server.port}/files///文件映射类@Component@ConfigurationProperties(prefix = "图片")public class StaticFile { private String uploadPath; private String url; public String getUploadPath原创 2020-08-13 15:00:51 · 442 阅读 · 0 评论 -
List集合 元素分组
字典表 封装成{"type":[{"value":"val","label":''val"}.....],"type":[{"value":"val","label":''val"}.....]}字典表集合根据 type分组List<SysDic> list = mapper.selectList();//构建数据结构Map<String,List<SysDic>> map = new HashMap();//封装数据for(SysDic dic : l原创 2020-08-11 17:19:56 · 1087 阅读 · 0 评论 -
java递归获取所有子级存到集合
java递归获取 父级下的所有子级项目需求表结构代码项目需求一个公司要获取到这个公司下的所有子公司,很多日志都是通过递归获取下级构成树形结构但是我这个不需要树形结构,是获取到所有子级放到集合中方便遍历如图表结构代码 private List<HjTManagement> selectHjTManagementListByPid(Long managementAreaId){ List<HjTManagement> list = new ArrayLi原创 2020-06-17 09:23:53 · 5274 阅读 · 2 评论 -
List转成 逗号 分隔的字符串
List<String> list = new ArrayList<>();list.add("小明1");list.add("小明2");list.add("小明3");list.add("小明4");String str = Joiner.on(",").join(list );//Joiner maven依赖<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->...原创 2020-06-08 14:15:17 · 434 阅读 · 0 评论